Author Topic: Multiple UIButton scripts in one object  (Read 1509 times)

ntopia

  • Newbie
  • *
  • Thank You
  • -Given: 6
  • -Receive: 0
  • Posts: 15
    • View Profile
Multiple UIButton scripts in one object
« on: May 09, 2014, 08:44:41 AM »
Hello!

I made a button with UISprite & UILabel.
If it is disabled, both of two should be changed.
So I searched in this forum and found an answer. "Simply attach multiple UIButton components."
It worked well.

My question is .. Is there any solution for changing state of UIButtons in one line?

I made it temporary.
I retrived all of UIButtons in object by GetComponents and called 'UIButton.SetState' for each.
But I think that it was not good.
Is there a solution better than that?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple UIButton scripts in one object
« Reply #1 on: May 09, 2014, 09:26:33 PM »
That's the right way to do it. You have multiple components, so you need to use GetComponents to retrieve them and set the state of each.