Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here:
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Question How to get if UI button is currently highlighted?

Discussion in 'Scripting' started by EpicMcDude, Oct 21, 2021.

  1. EpicMcDude


    Apr 15, 2013

    Trying to figure out a simple way to know if a UI button is currently highlighted or not, this is for using a gamepad or keyboard, so I can't use OnPointerEnter or OnMouseOver methods or anything that exclusively uses a mouse.

    I'm not proficient in C#.

    I've been googling around but nothing seems to work so far -
    This one only works once the button is selected, not highlighted.
    This seems to be the closest thing to what I want, but I can't seem to make this work, I get the error "No overload method for "IsHighlighted" takes 1 arguments" and I have no idea how to fix it.

    Thank you!
  2. RadRedPanda


    May 9, 2018
    What's your code look like?