/// <summary> /// Initializes a new instance of the <see cref="Adic.EventCallerContainerExtension"/> class. /// </summary> public EventCallerContainerExtension() { //Creates a new game object for UpdateableBehaviour. var gameObject = new GameObject(); gameObject.name = "EventCaller"; eventCaller = gameObject.AddComponent<EventCallerBehaviour>(); }
/// <summary> /// Initializes a new instance of the <see cref="Adic.EventCallerContainerExtension"/> class. /// </summary> public EventCallerContainerExtension() { //Creates a new game object for UpdateableBehaviour. var gameObject = new GameObject(); gameObject.name = "EventCaller"; eventCaller = gameObject.AddComponent <EventCallerBehaviour>(); }
/// <summary> /// Create the EventCalledBehaviour. At any time there should be a single behaviour on the scene. /// </summary> /// <param name="containerID">Container ID.</param> private void CreateBehaviour(object containerID) { if (behaviour == null) { // Create a new game object for UpdateableBehaviour. var gameObject = new GameObject(); gameObject.name = String.Format("EventCaller ({0})", containerID); // The behaviour should only be removed during unregister. MonoBehaviour.DontDestroyOnLoad(gameObject); behaviour = gameObject.AddComponent <EventCallerBehaviour>(); behaviour.extension = this; } }
public void OnUnregister(IInjectionContainer container) { container.afterAddBinding -= this.OnAfterAddBinding; container.bindingResolution -= this.OnBindingResolution; if (behaviour != null && behaviour.gameObject != null) { MonoBehaviour.DestroyImmediate(behaviour.gameObject); } behaviour = null; disposable.Clear(); updateable.Clear(); lateUpdateable.Clear(); fixedUpdateable.Clear(); focusable.Clear(); pausable.Clear(); quitable.Clear(); }