示例#1
0
        private void Awake()
        {
            if (_instance != null)
            {
                Debug.LogError("Tried to create another UnityWrapper instance! Destroying the new instance with extreme prejudice...");
                GameObject.Destroy(this.gameObject);
                return;
            }

            _instance = this;

            // this singleton persists for the lifetime of the application
            DontDestroyOnLoad(gameObject);
        }
示例#2
0
 /// <summary>
 /// Call this to destroy all modules and invalidate this entity.
 /// </summary>
 public void Destroy()
 {
     UnityWrapper.Unregister(this);
     DestroyInternal();
     _myEntity = null;
 }
示例#3
0
 protected UnityBehaviour()
 {
     UnityWrapper.Register(this);
 }