protected void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); //init pools pools = new Dictionary <string, List <PoolManager> >(); foreach (VFXDataHolder dataHolder in data) { foreach (VfxData vfxData in dataHolder.list) { if (!pools.ContainsKey(vfxData.id)) { pools.Add(vfxData.id, new List <PoolManager>()); } foreach (Vfx vfx in vfxData.vfxs) { pools[vfxData.id].Add(Pools.AddPool(vfx, transform)); } } } }
// Use this for initialization void Start() { foreach (Transform transformPool in poolObj) { pools.AddPool(transformPool); } }