Author Topic: Set the state of a UIButton and/or Collider in code  (Read 2994 times)

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Set the state of a UIButton and/or Collider in code
« on: March 30, 2014, 08:05:55 PM »
Is it possible to set the state of a UIButton to being 'pressed' in code? (via thru NGUI, its collider, or some other method)

There are situations that I want a UI element to be shown in the pressed state, when something else is pressed or some action has occurred. I know I can set the sprite's 'normal' state to use the 'pressed' graphic, but this would require management to reset it back after, I wanted to know if there was a more direct way.

« Last Edit: March 30, 2014, 08:38:06 PM by nguiman »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Set the state of a UIButton and/or Collider in code
« Reply #1 on: March 31, 2014, 06:27:02 AM »
No, button logic can't be forced to stay in a pressed state. That would make it a toggle, not a button. If you need that, then just use a toggle.