Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active May 3, 2023 10:18
Show Gist options
  • Select an option

  • Save unitycoder/041fc2cde8d95f1473af0809fce43679 to your computer and use it in GitHub Desktop.

Select an option

Save unitycoder/041fc2cde8d95f1473af0809fce43679 to your computer and use it in GitHub Desktop.
Check if mouse is over UI element
if (eventSystem.IsPointerOverGameObject()) return;
if (eventSystem.currentSelectedGameObject != null) return;
// this works with Oculus vr also:
if (EventSystem.current.IsPointerOverGameObject()) return;
if (EventSystem.current.currentSelectedGameObject != null) return;
@unitycoder

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment