Created
March 12, 2016 08:46
-
-
Save unitycoder/bfbaa501a7ddc71dbe6a to your computer and use it in GitHub Desktop.
Get Selected UI GameObject with EventSystem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.EventSystems; | |
| public class GetCurrentUIObject : MonoBehaviour | |
| { | |
| void Update() | |
| { | |
| // prints Null if nothing is selected, or name of the gameobject | |
| Debug.Log(EventSystem.current.currentSelectedGameObject); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment