public void Initialize() { pools = new Dictionary <string, ObjectsPool>(); GameObject r = new GameObject { name = "-Pools" }; foreach (var item in PoolConfig.Pools) { ObjectsPool p = new ObjectsPool(); GameObject g = GameObject.FindGameObjectWithTag(item.parentTag); if (!g) { g = new GameObject { name = item.parentTag, tag = item.parentTag }; g.transform.parent = r.transform; } p.Initialize(item.prefab, item.amount, g.transform); pools.Add(item.poolName, p); } }
private void Start() { ObjectsPool.Initialize(items); }