using System; using UnityEngine; public class EnableSwitch : MonoBehaviour { public bool SetActive(int target) { if (target < 0 || target >= this.SwitchTargets.Length) { return false; } for (int i = 0; i < this.SwitchTargets.Length; i++) { this.SwitchTargets[i].SetActive(false); } this.SwitchTargets[target].SetActive(true); return true; } public GameObject[] SwitchTargets; }