Created
April 25, 2018 17:16
-
-
Save StewMcc/4c45a11eecf0f5aefae29444d1ba5fbe to your computer and use it in GitHub Desktop.
This file contains 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
public class UnityUiExtensions { | |
/// <summary> | |
/// Check if the mouse or first finger is over Unity UI element. | |
/// </summary> | |
/// <returns></returns> | |
private bool IsOverUi() { | |
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR | |
return EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId); | |
#else | |
return EventSystem.current.IsPointerOverGameObject(); | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment