private void Awake() { if (instance) { Debug.LogWarning("Only one instance of the MoveObject script in a scene is allowed"); return; } instance = this; }
/// <summary> /// Upon resetting the game, all spawned objects will be removed. /// </summary> private void RemoveObjects() { MenuRotator menuRotator = objectMenu.GetComponent <MenuRotator>(); foreach (GameObject spawn in menuRotator.spawnedObjects) { Destroy(spawn); } menuRotator.spawnedObjects.RemoveRange(0, menuRotator.spawnedObjects.Count); }