Author Topic: isEnabled in 3.0.6 version  (Read 1797 times)

rox79

  • Guest
isEnabled in 3.0.6 version
« on: November 29, 2013, 03:03:33 AM »
Hi,

with new version 3.0.6 I have problem with isEnabled.
It still disable UIButton and Collider, but color doesn't change to Disabled.
Does new version change the way it works ?! or is it just a bug ?!

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: isEnabled in 3.0.6 version
« Reply #1 on: November 29, 2013, 09:24:16 AM »
Don't do either. Set isEnabled = false instead.

Devil_Inside

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: isEnabled in 3.0.6 version
« Reply #2 on: November 29, 2013, 02:52:13 PM »
Setting isEnabled doesn't change the button's color to the disabled state.
I've checked out the source for the UIButton and the OnDisable() code is commented out. I can clearly remember it was uncommented the last time I checked.
Also, it would be great if the button could be set to disabled state, before its Start method is run for the first time. So you could disable the button from some other controllers Start method.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: isEnabled in 3.0.6 version
« Reply #3 on: November 29, 2013, 07:36:29 PM »
Hmm... you're right. I guess it was causing issues at some point so I had it commented out. Change isEnabled to the following:
  1.         public bool isEnabled
  2.         {
  3.                 get
  4.                 {
  5.                         if (!enabled) return false;
  6.                         Collider col = collider;
  7.                         return col && col.enabled;
  8.                 }
  9.                 set
  10.                 {
  11.                         Collider col = collider;
  12.                         if (col != null) col.enabled = value;
  13.                         else enabled = value;
  14.                         UpdateColor(value, false);
  15.                 }
  16.         }

rox79

  • Guest
Re: isEnabled in 3.0.6 version
« Reply #4 on: November 30, 2013, 06:07:33 AM »
So just a bug.