Question : i m sort of learning the facebook sdk example implementation scripts in unity. i came across this code GUI.enabled, i have no idea what it meant! so i did some experiment, base on unity documentation code.
heres unity code that i did experiment with it.
heres unity code that i did experiment with it.
notice that GUI.enabled is called twice in this code.
- the first value of GUI.enabled is based on user click, if user selected the "Edit All Options"toggle button, then the value returned is true.
- second value of GUI.enabled assigned to false.
After the GUI.enabled is called, all the GUI component called after it will be enabled/disabled depending GUI.enabled value.
On second call, GUI.enabled is set to false, all the component called after it will be disabled. *see the button ok always been disabled.
First scenario:
- "Edit All Options" always been enabled, from code we can see that the GUI.enabled is been called after the edit all options toggle button created. "Edit All Options" is selected.
- As "Edit All Options" is selected, "Extended Option 1" and "Extended Option 2" is enabled as well.
- "Ok" is disabled, as GUI.enabled value been set to false, before "Ok" button been created.
Second scenario:
- "Edit All Options" always been enabled, from code we can see that the GUI.enabled is been called after the edit all options toggle button created
- As edit all options is not selected, "Extended Option 1" and "Extended Option 2" is disabled as well.
- "Ok" is disabled, as GUI.enabled value been set to false, before "Ok" button been created.
Conclusion:
by default GUI.enabled value is "true".
After the GUI.enabled called and new value being assigned to it, what ever GUI component called after it will follows the GUI.enable value set, either its being enabled or disabled.
Comments
Post a Comment