protected override void OnDestroy() { if (!Container.IsDisposing && !Container.IsDisposed) { Container.Dispose(); } Instance = null; base.OnDestroy(); }
protected override void Awake() { base.Awake(); DontDestroyOnLoad(gameObject); if (Instance != null) { throw new InvalidOperationException($"There is already an instance of '{nameof(UnityApp)}'."); } Instance = this; Container = new Container(); Container.BindInstance <ITickService>(gameObject.AddComponent <TickService>()); }