gui.button alternative

Hello! i’m quite familiar with the gui.button method but i want to make something different. Using gui.button when the user is touching the screen nothing happens, when he releases his finger from the screen the coded event happens. What i want to do is that when the user is touching the screen an event happens (a value increases by a percent every second) and when he releases his finger the event stops. Someone knows how can i make this?

Use a coroutine that counts the time this button is pressed.
Example from a project of mine (C#):

IEnumerator loseLivesCoroutine()
        while (this.collider != null && == "Character")
            yield return new WaitForSeconds(loseLiveInterval);

        yield return null;

Break the loop using a bool whether the button is pressed or not.

I’ve just found this. It’s a lot easier:

I have a problem with GUI.RepeatButton : when i keep a button pressed a value increases over time and that’s ok but when i press another GUI.RepeatButton that should decrease that value it works as a normal button, it just decreases that value once and then stops. I have to press this button a second time so that the value decreases correctly over time. Why this happens?