Search Unity

Hold down UI button

Discussion in 'Scripting' started by Corva-Nocta, May 28, 2021.

  1. Corva-Nocta

    Corva-Nocta

    Joined:
    Feb 7, 2013
    Posts:
    801
    Hey all, I'm having trouble remembering/finding how to make a function happen while I hold down a UI button. Nothing complex, just want to move the player in one direction when I hold down the UI button. I know how to do something when I press a UI button down, but not when I hold a UI button down.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    The magic sauce you seek is called an
    EventTrigger
    and you attach it to an otherwise vanilla Button.
     
    Corva-Nocta likes this.