public static void ClearAllMono() { foreach (var c in Cubes) { GameObject.Destroy(c); } Cubes.Clear(); foreach (var c in CubesWithScript) { GameObject.Destroy(c); } CubesWithScript.Clear(); }
public static void CreateCubesMono(bool aIsWithScript) { WatchStart(); for (int i = 0; i < mCreateCountMono; i++) { var pos = RandomPos(); var cube = GameObject.Instantiate(CubePrefab, pos, Quaternion.identity); if (aIsWithScript) { cube.AddComponent <BallMoveMono>(); Cubes.Add(cube); } else { CubesWithScript.Add(cube); } } Debug.Log("Cost " + WatchStop() + " Milliseconds Creating " + mCreateCountMono + " MonoCubes."); }