On Mouse Down node
Note
The On Mouse Down 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 Down node listens for a mouse click action on a specific GameObject in your application. It triggers the next node connected to it after the action occurs in the application. It doesn't send or receive any other data.
Fuzzy finder category
The On Mouse Down node is in the Events > Input category in the fuzzy finder.
Inputs
The On Mouse Down node has one input port:
Name | Type | Description |
---|---|---|
Target | GameObject | The GameObject that the user needs to click with their mouse to trigger the On Mouse Down node. |
Additional node settings
The On Mouse Down node has additional settings. Access these settings from the Graph Inspector:
[!include[nodes-coroutine](./snippets/nodes-coroutine.md)]Name | Type | Description |
---|
Outputs
The On Mouse Down node has one output port:
[!include[nodes-input-output-trigger](./snippets/input-manager/nodes-input-output-trigger.md)]Name | Type | Description |
---|
Example graph usage
In the following example, the On Mouse Down node listens for a click action on the GameObject where the graph runs. When a user clicks the GameObject, the On Mouse Down node triggers the GameObject Instantiate node. The Instantiate node creates a new GameObject, based on the Ball Prefab. It creates the Ball at a specific Position. It uses the Transform Get Local Rotation to match the new GameObject's Rotation to the GameObject where the Script Graph runs. Then, the graph adds a Rigidbody component to the new GameObject, and uses a Rigidbody Add Force node to add an Impulse force.
When the user clicks the mouse button, the Script Graph creates a new Ball GameObject and sends it towards the camera.
Related nodes
The following nodes are related or similar to the On Mouse Down node: