Author Topic: Why does my button become greyed out when I play the scene?  (Read 3935 times)

alexh0101

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 30
    • View Profile
Using NGUI 3.5

I have a "UI Button (Script)", a Box Collider 2D and a "UISprite (script)".
My problem is when I hit "Play", the "Normal" colour becomes grey, instead of staying white.
And the button doesn't work.

Is there anything missing in my components?
Would the button work if I used UI2DSprite instead of UISprite?


Also, when I hit Play, a new component appears in the button "Tween Color (script)".

Why is that happening?

Thanks in advance

Arcio

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Why does my button become greyed out when I play the scene?
« Reply #1 on: July 17, 2014, 02:12:26 PM »
It sounds like the button is becoming inactive. In your button script, change the inactive to pink and see if it turns pink instead. If so, then that's your culprit. Just figure out what is setting it to inactive.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Why does my button become greyed out when I play the scene?
« Reply #2 on: July 17, 2014, 03:42:30 PM »
There's probably no collider on it, which means it triggers the inactive state.

alexh0101

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Why does my button become greyed out when I play the scene?
« Reply #3 on: July 17, 2014, 05:08:09 PM »
Hi again,

Thanks for your responses.
I figured out that the box collider I had on that object was added through Unity, instead of through NGUI's right-click/Attach/Box collider.

Thanks for your help.