UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"When all objects are destroyed, activate another script"
using UnityEngine; public class ActivateScriptOnAllObjectsDestroyed : MonoBehaviour { public GameObject[] objectsToDestroy; public MonoBehaviour scriptToActivate; void Update() { // Check if all objects are destroyed bool allObjectsDestroyed = true; foreach (GameObject obj in objectsToDestroy) { if (obj != null) { allObjectsDestroyed = false; break; } } // If all objects are destroyed, activate the script if (allObjectsDestroyed) { scriptToActivate.enabled = true; } } }