/// <summary> /// Allocates a game object from the specified pool /// </summary> /// <param name="rPrefab">GameObject that is our template</param> /// <returns></returns> public static void Initialize(ScriptableObject rPrefab, bool rDeepCopy) { if (rPrefab == null) { return; } if (!sPool.ContainsKey(rPrefab)) { ScriptableObjectPool lPool = new ScriptableObjectPool(rPrefab, 5, rDeepCopy); sPool.Add(rPrefab, lPool); } }
/// <summary> /// Allocates a game object from the specified pool /// </summary> /// <param name="rPrefab">GameObject that is our template</param> /// <returns></returns> public static ScriptableObject Allocate(ScriptableObject rPrefab, bool rDeepCopy) { if (rPrefab == null) { return(null); } if (!sPool.ContainsKey(rPrefab)) { ScriptableObjectPool lPool = new ScriptableObjectPool(rPrefab, 5, rDeepCopy); sPool.Add(rPrefab, lPool); } return(sPool[rPrefab].Allocate()); }