using UnityEngine; namespace Game { public class EntityPoolItem : ObjectPoolItemBase { public GameObject GameObject; protected override void OnCreate() { base.OnCreate(); GameObject.SetActive(false); } protected override void OnDestroy() { base.OnDestroy(); GameObject.SetActive(false); } } public class EntityPoolManager : ObjectPoolBase { public EntityPoolItem CreateEntity(string entityId) { var entityNew = Create($"Entity{entityId}", item => { item.GameObject = CreateEntityGo(entityId); item.GameObject.transform.SetParent(Root.transform); }); return entityNew; } private GameObject CreateEntityGo(string entityId) { var path = $"{entityId}"; return PrefabManager.Instance.CreateGo(path); } } }