GUI.RepeatButton funcionality with new Unity UI (4.6.x)


How can I achieve the GUI.RepeatButton functionality with the new Unity UI Buttons?

Add a Event UI component that tracks when the pointerUp/Down is true/false to your button:

  1. Component > Event > Event Trigger

  2. Once you are on the component:
    Click add
    Pointer Down
    Pointer Up

Both are PointerEventData

  1. Have these booleans operate on the boolean for repeatbutton (or buttondown)

Although not technically a repeat button, you could create a button that toggles a Boolean.

Then in your Update() method execute code conditionally base on your bool value.

Click the button the first time will start the desired behavior and clicking it again will stop it.

private bool isIncrementCounter = false;

void Update () 
    if (isIncrementCounter)

//Attach this method to your onClick event for your button...
void IncreaseCounterButton_onClick()
    isIncrementCounter = !isIncrementCounter;