public virtual void RemoveSelf() { if (MyModel != null) { PathologicalGames.SpawnPool spawnPool = ActorManager.Instance.EffectSpawnPool; if (spawnPool.IsSpawned(MyModel.transform)) { spawnPool.Despawn(MyModel.transform); MyModel = null; } else { Debug.LogError("检查一下为什么没有调用对象池"); } } }
private void _Despawn() { PathologicalGames.SpawnPool pool = PathologicalGames.PoolManager.Pools.ContainsKey(originSpawnPoolName) ? PathologicalGames.PoolManager.Pools[originSpawnPoolName] : null; if (pool != null && pool.IsSpawned(this.transform)) { pool.Despawn(this.transform); } else { Debug.LogWarning("Object spawned outside of pool; unable to despawn, so destroying object instead.", this.gameObject); Destroy(this.gameObject); } }