void OnMouseOver() { if (_outline == null) { Renderer rend = GetComponentInChildren <Renderer>(); _outline = rend.gameObject.AddComponent <Outline>(); GameObject player = GameObject.FindWithTag("Player"); AshleyController controller = player.GetComponent <AshleyController>(); controller.target = rend.gameObject; } }
void OnMouseExit() { if (_outline != null) { GameObject player = GameObject.FindWithTag("Player"); AshleyController controller = player.GetComponent <AshleyController>(); controller.target = null; Destroy(_outline); _outline = null; } }