-
Notifications
You must be signed in to change notification settings - Fork 9
对象池
Hiram edited this page Apr 2, 2018
·
1 revision
- 对象池
public void TestMethod() { var pool = new Pool<GameObject>(new GameObjectHandler()); var go = pool.Get(); pool.Reclaim(go); } class GameObjectHandler : IPoolHandler<GameObject> { public GameObject Create() { return UnityEngine.Object.Instantiate(Resources.Load("")) as GameObject; } public void Destory(GameObject obj) { Destory(obj); } public void InToPool(GameObject args) { args.SetActive(false); } public void OutFromPool(GameObject args) { args.SetActive(true); } }