using System.Collections; using System.Collections.Generic; using UnityEngine; using static Unity.VisualScripting.Metadata; public class ObjectSelection : MonoBehaviour { public GameObject unselectedArrow; public GameObject selectedArrow; public GameObject yellowBox; public GameObject blueBox; public bool selected = false; public void selectUnSelectObject() { if (selected == false) { selected = true; unselectedArrow.SetActive(false); selectedArrow.SetActive(true); yellowBox.SetActive(false); blueBox.SetActive(true); } else if (selected == true) { selected = false; unselectedArrow.SetActive(true); selectedArrow.SetActive(false); yellowBox.SetActive(true); blueBox.SetActive(false); } } } /* Previous code: // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void selectUnSelectObject(GameObject currentGameObject) { foreach (Transform child in currentGameObject.transform) { if (child.tag == "selectingSignifier") { if(child.gameObject.activeInHierarchy) { child.gameObject.SetActive(false); } else { child.gameObject.SetActive(true); } } } // List foundObjects = new List(); // GameObject[] allObjects = GameObject.FindObjectsOfType(true); // foreach (GameObject obj in allObjects) // { // if (obj.CompareTag("selectingSignifier")) // { // obj.SetActive(true); // } // } } */