docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License
    Show / Hide Table of Contents
    • About Visual Scripting
      • Configure project settings
        • Add or remove available nodes
        • Add or remove types
        • Create or restore a backup
      • Choose a control scheme
      • Configure your preferences
      • Update Visual Scripting
      • Version control systems
      • Use Visual Scripting with Unity Cloud Build
    • Basic concepts in Visual Scripting
      • The interface
      • Nodes
      • Graphs
        • Subgraphs and State Units
        • Transitions
      • Script Machines and State Machines
      • Object types
        • Custom types
      • Variables
    • Develop application logic with Script Graphs
      • Create a new graph file
        • Create a new blank graph with the Project window
        • Create a new unassigned graph with the empty graph creation flow
        • Create and assign a graph to an existing Game​Object
        • Create and assign a graph to a new Game​Object
        • Create a graph on a Script Machine or State Machine
      • Attach a graph file to a Script Machine or State Machine
      • Open a graph file
        • Add a node to a Script Graph
        • Connect nodes in a Script Graph
        • Create and add a variable to a Script Graph
        • Create node groups
        • Add comments to a graph
      • Add a Subgraph to a Script Graph
        • Add a Trigger or Data port to a Script Graph
      • Add a State Unit to a Script Graph
      • Custom Events
        • Add a Custom Event node
        • Add a Trigger Custom Event node
      • Capture user input in an application
        • Capture input using the Input Manager
        • Add and configure a Player Input component
        • Capture input using the Input System package
      • Use relations to debug
        • Predictive and live debugging
        • Working with debug messages
      • Live edit
        • Live edit during runtime
    • Develop logic transitions with state graphs
      • Create a new state
      • Create a transition between states
    • Advanced customization and development
      • Refactor a C# script with Visual Scripting
        • Add the Renamed​From attribute to a C# script
      • Custom C# nodes
        • Create a new simple Custom C# node
        • Add ports to your Custom C# node
        • Add logic to your Custom C# node
        • Add relations to your Custom C# node
        • Add documentation to your Custom C# node
        • Custom C# node attributes reference
      • Create a Custom Scripting Event node
        • Create a Custom Scripting Event Sender node
        • Trigger a Custom Scripting Event from a C# script
        • Listen to a Custom Scripting Event from a C# script
      • Use a custom type
        • Add the Inspectable attribute to a custom type
        • Create a custom Property​Drawer for a custom type
    • Node reference
      • This node
      • Control node
      • Time node
      • Events
        • Event nodes
        • Input Event nodes
          • On Input System Event Button
          • On Input System Event Float
          • On Input System Event Vector 2
          • On Button Input
          • On Keyboard Input
          • On Mouse Down
          • On Mouse Drag
          • On Mouse Enter
          • On Mouse Exit
          • On Mouse Input
          • On Mouse Over
          • On Mouse Up As Button
          • On Mouse Up
      • Variable node
      • Nulls node
      • Formula node
      • Nesting
        • Input node
        • Output node
        • State Unit node
        • Subgraph node
      • Script graph nodes
      • State graph nodes
    • Developer's guide
    • Manual
    • Node reference
    • Events
    • Input Event nodes
    • On Mouse Over

    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.

    An image of the Graph window. An On Mouse Over node displays with its details in the Graph Inspector.

    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.

    An image of the Graph window. An On Mouse Over node has a Target of the current GameObject where the Script Graph runs. Its Trigger output port connects to the Toggle input port on a Timer node. It uses an inline value of 2 for its Duration. Its Tick output port connects to the Invoke input port on a Color Lerp node. The Timer node's Elapsed output port connects to the T input port on the Color Lerp node. The Color Lerp node uses inline values for its A and B input colors. Its Exit port connects to the Invoke input port on a Material Set Color node. The Color Lerp node's Result port connects to the Material Set Color node's Value port. The Material Set Color node uses inline values for its Target material and the Name of the color property it should modify.

    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.

    An image of the Game view. Three red spheres sit on a plane.

    An image of the Game view. Three purple spheres sit on a plane.

    Related nodes

    The following nodes are related or similar to the On Mouse Over node:

    • On Button Input node
    • On Keyboard Input node
    • On Mouse Down node
    • On Mouse Drag node
    • On Mouse Enter node
    • On Mouse Exit node
    • On Mouse Input node
    • On Mouse Up node
    • On Mouse Up As Button node
    In This Article
    • Fuzzy finder category
    • Inputs
    • Additional node settings
    • Outputs
    • Example graph usage
    • Related nodes
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023