コード例 #1
0
 private void HandleGameObjectDestroy(GameObjectBehaviour sender, DestroyReason destroyReason)
 {
     if (Value is MonoBehaviour monoBehaviour && monoBehaviour.gameObject == sender.CachedGameObject)
     {
         Value = null;
     }
 }
コード例 #2
0
        private void HandleDestroyed(GameObjectBehaviour sender, DestroyReason reason)
        {
            if (reason != DestroyReason.ApplicationQuit)
            {
                return;
            }

            Invoke(new ApplicationQuitEvent());
#if UNITY_EDITOR
            OwningLocator?.Dispose();
#endif
        }
コード例 #3
0
        /// <inheritdoc/>
        public GameObjectPool.DespawnResult Despawn(GameObjectBehaviour instance)
        {
            if (!instance.TryGetValid(out instance))
            {
                return(GameObjectPool.DespawnResult.Aborted);
            }

            if (instance.Pool.TryGetValid(out GameObjectPool pool))
            {
                return(pool.Despawn(instance));
            }

            instance.Destroy();

            return(GameObjectPool.DespawnResult.Destroyed);
        }
コード例 #4
0
 internal static void AddCachedBehaviour(GameObjectBehaviour behaviour)
 {
     Behaviours.Add(behaviour.CachedGameObject, behaviour);
 }
コード例 #5
0
 public static bool IsPersistent(this GameObjectBehaviour behaviour)
 {
     return(IsPersistent(behaviour.CachedGameObject));
 }
コード例 #6
0
 private void HandlePoolDestroyed(GameObjectBehaviour sender, DestroyReason reason)
 {
     RemovePool((GameObjectPool)sender, false);
 }