Author Topic: Disable button after click  (Read 2889 times)

fanling3

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 29
    • View Profile
Disable button after click
« on: July 14, 2014, 05:51:23 AM »
I have UIButton with OnClick event and UIPlay Animation which is about 0.5s long.
What I did to OnClick event is
  1. Invoke("ChangeScene", 0.5f);
So that the user can see the UIPlay Animation before the scene is switched.

But the problem is, the user can click more than once before the scene is switched.

I can define a local variable to keep track so the button can only be clicked once but I have many buttons in my game so I don't want to define so many variables myself unless it's the only way.

Is there any quick way in NGUI to do this task: Disable UIButton after click
Or I can handle this in any other way?

Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disable button after click
« Reply #1 on: July 15, 2014, 12:26:35 AM »
If you turn off the UICamera script then events won't be sent out and it won't me possible to click again. You can also disable the button by simply setting its isEnabled to false.