**⚠️ How To Select UI Elements with uVS using the New Input System, that uses "Event System".
**
...without "Event Trigger" or "Button" Components...
This allows you to dynamically select elements in your UI from one single manager.
Without custom events and a script machine per UI element - such as Inventory bag slots, weapon slots, potion slots.
Before I had 1 script machine per item slot, and their variations. 15 Item slots, 4 gear slots, 2 potions, and 2 weapons. This gives a total of 23 script machines running in the background even if they wait for input. +23 Calls in the profiler.
Now I'll be able to use 1 single script machine for my entire inventory system. Which is in the process...
Part of my insane refactor process, more details can be found here: #1479879529450307836 - When I finish refactoring my inventory system, I will post updates here.
--
👨💻 If anyone in the future needs this.. this is how it's done:
-
Project Settings >> Visual Scripting >> Add Type Options: [ RaycastResult ]... then, Regenerate Nodes.
-
Get your Graphic Raycaster component as an Object Variable, the one that is the parent Canvas of the elements you want to detect.
-
Get Graph variable for raycastResultsList type (List<RaycastResult>) || I tried using Flow variable for this, didn't work. Stick with Graph.
-
Follow the sequence in the graph.
-
Set Graph variable for the element you want to select, and make sure it has Bool variable and use nodes "Has Variable" so it doesn't select any object but what you want.