Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: theprojectabot on November 11, 2012, 07:33:34 PM
-
So I setup this button that triggers a menu to slide up and another menu to slide up underneath it.
However some of the elements in my secondary menu had their colliders turned off as I wanted to make sure that those areas of my game were not accessible through those buttons.
However because the Panel that housed these buttons we being set to EnableThenPlay through the UIButtonPlayAnimation and this action of EnableThenPlay forced a recursive NGUI.SetActive() call the buttons were not updating their Color to disabled dependent on the collider setting for the button.
I dug into this and realized that when the panel was being set to active the OnEnable() function at the UIButton level was not being called. So I just went to UIButtonColor and added a call to OnEnable in the Start() method. Now when my panels are first set to active and all their children are set to active, the OnEnable method is called and my buttons are set to Update their color depending on their collider active setting.
Hope this helps anyone else!
code change is:
void Start () { mStarted = true; OnEnable();} IN UIButtonColor, this ends up calling the child classes implementation of OnEnable and does the check.