Author Topic: How do I know the button is being pressed?  (Read 7798 times)

bodosaher

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
How do I know the button is being pressed?
« on: September 11, 2013, 06:43:48 PM »
I need to know if a button is being pressed, I dont a method that is being called as long as the button is held down?
Does onPress do that because i feel it only simulates the first click?

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: How do I know the button is being pressed?
« Reply #1 on: September 11, 2013, 07:20:29 PM »
OnPress is only called when the button is initially pressed, or when it is released.

You could do something like the following if you want to know when the button is held down:

  1. public bool Held { get; protected set; }
  2.  
  3. void OnPress(bool pressed)
  4. {
  5.     Held = pressed;
  6. }

bodosaher

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: How do I know the button is being pressed?
« Reply #2 on: September 11, 2013, 07:34:11 PM »
Thanks wumpee :)