Created
May 11, 2017 21:50
-
-
Save unity3dcollege/e20fc2ef5c859b56bc052f13299aa6d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Pool GetPool(IPoolable prefab) | |
{ | |
if (pools.ContainsKey(prefab)) | |
{ | |
if (pools[prefab] != null) | |
return pools[prefab]; | |
else | |
pools.Remove(prefab); | |
} | |
var pool = new GameObject("Pool-" + (prefab as Component).name).AddComponent<Pool>(); | |
pool.Initialize(prefab); | |
pools.Add(prefab, pool); | |
return pool; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment