/// <summary> /// Sets the static reference and builds the pool. /// </summary> private void Awake() { pool = this; PopulatePool(); }
/// <summary> /// Finds an instance of me in the scene, if one doesn't exist, then create one. /// </summary> private static void FindPoolInScene() { pool = FindObjectOfType(typeof(ShardPool)) as ShardPool; if(pool == null) { GameObject newPool = new GameObject("_Shard Pool"); pool = newPool.AddComponent<ShardPool>(); } }