using System.Collections; using System.Collections.Generic; using UnityEngine; public class Building : MonoBehaviour { public string buildingName; public Outline outline; void Awake(){ if(outline == null){outline = GetComponent();} outline.enabled=false; Selector.OnSelectedChanged.AddListener(OnSelectedChanged); } void OnSelectedChanged(){ if(Selector.selectedBuilding == null){outline.enabled=false; return;} outline.enabled = Selector.selectedBuilding == this; Debug.Log(buildingName); // this function debugs 4 names and not always the one u clicked. // SetRightUpgradeButton(); // function to let the button know what menu to open, also runs 4+ times. } /* void SetRightUpgradeButton(){ switch (buildingName) { case "Research Facility": Debug.Log("research facility menu"); break; case "Green House": Debug.Log("green house menu"); break; } } */ }