Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Continuous trigger while GUI button down?

Discussion in 'Immediate Mode GUI (IMGUI)' started by bigkahuna, Apr 15, 2008.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I'm using a bit of code like this...

    Code (csharp):
    1.     if (Button (GUIContent ("Up", hint1))  cValue < 70.0) {
    2.         cValue += Time.deltaTime * rate;
    3.     }
    ...to increase the value of "cValue" each time a GUI button is clicked. How can I change this so that "cValue" continues to increase so long as the button is held down?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Use the RepeatButton instead.
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Wow, how'd I miss that little gem? Thanks Joe!