Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Controller button press to Select new UI Button is Submitting that Button

Discussion in 'Input System' started by FuriousEX, Nov 18, 2023.

  1. FuriousEX

    FuriousEX

    Joined:
    Mar 13, 2014
    Posts:
    51
    Hi, I am running into difficulty adding controller support to a UI. Specifically my use pattern is this:

    - The input system fires a Button event when pressed, and if the EventSystem.current.currentSelectedGameObject is a particular object, I then:

    - Drill down to a particular menu, and default select a button there using EventSystem.current.SetSelectedGameObject

    What happens is the newly selected UI Button receives the OnSubmit from the prior event, basically leading to an auto click.

    Is there a better way to set this up? I have some hacky mitigation but I'd imagine there's a built in way to prevent.

    Thanks!