On Mouse Input node
Note
The On Mouse Input 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 Input node listens for a specific action on a user's mouse. The action doesn't need to happen on a specific GameObject's Collider. 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 Input node is in the Events > Input category in the fuzzy finder.
Inputs
The On Mouse Input node has the following input ports:
Name | Type | Description | |
---|---|---|---|
Button | Mouse Button | The name of the mouse button that triggers the On Mouse Input node. | |
Action | Press State | The specific state of the mouse button that the node listens for. | |
Hold | The user holds down the mouse button. | ||
Down | The user presses the mouse button. | ||
Up | The user releases the mouse button. |
Additional node settings
The On Mouse Input node has additional settings. Access these settings from the Graph Inspector:
Name | Type | Description |
---|
Outputs
The On Mouse Input node has one output port:
Name | Type | Description |
---|
Example graph usage
In the following example, the On Mouse Input node listens for the user to hold the right mouse button and triggers an Instantiate Camera node. The Instantiate node clones the camera saved as the Camera1 Scene variable and assigns it to the NewCamera Scene variable. It sets a new position for the cloned camera with a Transform Set Position node, before it switches which camera renders in the Game view with the Camera Render node.
When the application runs, the default view in the Game view displays all three spheres in the scene.
When the user holds the right mouse button and triggers the On Mouse Input node, the Game view changes to focus on the middle sphere.
Related nodes
The following nodes are related or similar to the On Mouse Input node: