Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Mouse click UI check passthrough.

$
0
0
As I've spent most of the afternoon working on this and others in this forum have asked about this type of issue, here is one example of how to deal with mouse click RayCast ignoring the UI Toolkit overlay (using 2021.3 / UI Toolkit / New Input System):

Code (CSharp):
  1.  
  2. private NavMeshAgent _navMeshAgent;
  3.  
  4. private void Start()
  5. {
  6.     // Find main UI overlay
  7.     VisualElement rootUIMain = FindObjectOfType<UIDocument>().rootVisualElement;
  8.  
  9.     // Register mouse down event on root of UI...
Mouse click UI check passthrough.

Viewing all articles
Browse latest Browse all 1466670

Trending Articles