using UnityEngine; public class HasControl : MonoBehaviour { public bool hasControl = true; public GameObject[] objectsToRemove; private void Awake() { UpdateControl(); } private void UpdateControl() { GameObject[] array = objectsToRemove; foreach (GameObject gameObject in array) { gameObject.SetActive(hasControl); } } public void ChangeControl(bool control) { hasControl = control; UpdateControl(); } }