Documentation for the Unity C# Library
Loading...
Searching...
No Matches
ReferenceResolver.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using PixoVR.Core;
5using UnityEngine;
6
7public class ReferenceResolver : MonoBehaviour
8{
9 [SerializeField] private List<MonoBehaviour> _referenceToRegister;
10
11 private void Awake()
12 {
13 foreach (var reference in _referenceToRegister)
14 {
15 Debug.Log($"Registering reference {gameObject.name}");
16 ServiceLocator.Register(reference);
17 }
18 }
19
20 private void OnDestroy()
21 {
22 foreach (var reference in _referenceToRegister)
23 {
24 Debug.Log($"Unregistering reference {gameObject.name}");
25 ServiceLocator.Unregister(reference);
26 }
27 }
28}
Unity components communication service.
List< MonoBehaviour > _referenceToRegister
[SerializeField]