Author Topic: Disabled button's label color again  (Read 2475 times)

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Disabled button's label color again
« on: August 30, 2013, 05:01:01 PM »
From what I've read in this forum the fact that disabled button's label color doesn't change to "disabled" color is intended behavior and it was suggested to use seconds UIButton component to color it. I've tried that and what happens is that if the button is disabled ( in my case by the being clicked itself) , the label keeps its "pressed" color, not the disabled one. Is that a bug?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disabled button's label color again
« Reply #1 on: August 30, 2013, 05:04:37 PM »
You disable the button when you click on it? Why? When you are clicking on a button, it's in pressed state. Since you disable it right then and there, it never gets the "unpressed" state, which is not right. You should delay your logic until the end of frame at least -- use a coroutine if nothing else.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Disabled button's label color again
« Reply #2 on: August 30, 2013, 05:10:08 PM »
I see, I will do that, thanks. As for the reason of the button being disabled by clicking it - it is used to fire a weapon which needs to recharged to fire again - in the meantime the button is disabled.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disabled button's label color again
« Reply #3 on: August 30, 2013, 05:15:38 PM »
I would recommend making it darker by putting a black semi-transparent sprite on top instead. Filled sprite, ideally. This way you can show a cooldown, and play an "error" sound when you click on the button. Flat out disabling it doesn't give the user any explanation as to why that is.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Disabled button's label color again
« Reply #4 on: August 30, 2013, 05:17:19 PM »
Good idea, will do that. Thanks :)