Exemple #1
0
        protected override void OnDestroy()
        {
            if (!Container.IsDisposing && !Container.IsDisposed)
            {
                Container.Dispose();
            }

            Instance = null;
            base.OnDestroy();
        }
Exemple #2
0
        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>());
        }