On Mouse Over node
Note
The On Mouse Over node is an Input Manager node. For more information about how to use the Input Manager with Visual Scripting, see Capture user input in an application.
The On Mouse Over node listens for a user's mouse to land over a specified GameObject's Collider. While the user's mouse is over the Collider, it triggers the next node connected to it once every frame. It doesn't send or receive any other data.
Fuzzy finder category
The On Mouse Over node is in the Events > Input category in the fuzzy finder.
Inputs
The On Mouse Over node has one input port:
Name | Type | Description |
---|---|---|
Target | GameObject | The GameObject with the Collider that triggers the On Mouse Over node. |
Additional node settings
The On Mouse Over node has additional settings. Access these settings from the Graph Inspector:
Name | Type | Description |
---|---|---|
Coroutine | Toggle | Enable Coroutine if you want Visual Scripting to run this node and any of its connected nodes as a coroutine. Coroutine nodes don't execute all their code in a single frame, so they can spread an effect over several frames. Coroutines can also help optimize your code. For more information on coroutines, see the Unity User Manual section on Coroutines. |
Outputs
The On Mouse Over node has one output port:
Name | Type | Description |
---|---|---|
Trigger | Output Trigger | The control output port. Make a connection to specify what Visual Scripting should do after the configured Input event occurs in your application. |
Example graph usage
In the following example, the On Mouse Over node triggers a Timer node when the user moves their mouse over the Target GameObject. The Timer runs for 2 seconds and triggers a Color Lerp node. For every Tick of the Timer node, the Color Lerp node uses the Elapsed value to calculate a new Color between Color A and Color B to make a smooth transition between colors. The Material Set Color node uses the Result from the Color Lerp node to set a new Color on the Object material.
While the user's mouse is over the Target GameObject, the objects that use the Object material in the scene transition from red to blue over two seconds. The transition repeats until the user's mouse leaves the Target's Collider.
Related nodes
The following nodes are related or similar to the On Mouse Over node: