Author Topic: Enabled/Disabled Sprites  (Read 4178 times)

swilskey

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Enabled/Disabled Sprites
« on: June 01, 2014, 04:49:17 PM »
I am having some problems with the Enabled Disabled sprites. The normal sprite always changes to the Disabled sprite. I am not sure exactly what is happening. I am using the newest NGUI. http://imgur.com/N3qq4Kf
« Last Edit: June 01, 2014, 04:56:00 PM by swilskey »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Enabled/Disabled Sprites
« Reply #1 on: June 01, 2014, 05:42:50 PM »
Your collider is disabled. Disabled collider = disabled button.

swilskey

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Enabled/Disabled Sprites
« Reply #2 on: June 01, 2014, 07:07:44 PM »
The problem is that when I enable the button it doesn't switch to the Normal button sprite. It can be enabled but still be the disabled sprite.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Enabled/Disabled Sprites
« Reply #3 on: June 02, 2014, 10:30:25 PM »
You need to use UIButton.isEnabled instead of modifying the collider's state, and it will update the sprite.

swilskey

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Enabled/Disabled Sprites
« Reply #4 on: June 11, 2014, 03:45:19 PM »
Thanks that makes sense. I am however having trouble using the UIButton.isEnabled This is the current script I am using to get the info from player prefs and changing the collider. I am not sure what I need to change.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Enabled/Disabled Sprites
« Reply #5 on: June 12, 2014, 02:27:43 AM »
Replace "collider.enabled = false;" with "GetComponent<UIButton>().isEnabled = false;"