Hi there,
I am having alot of problems to create a UI with 2 tabs with enabled/disabled content.
Today I am using NGUI.SetActive to enable/disable tabs and content. Like:
# Tabs.js
function SetActiveTab(current: int) {
for (var i = 0 ; i < tabs.length ; i++)
NGUITools.SetActive(tabs[i], i == current);
}
# Tab0.js
functoin Start() {
NGUITools.SetActive(button, false);
}
When I activate a tab, its activate the disabled button too. OnEnable don't work because parent are enabled before its children.
I can only see some not to good solutions:
1) I must change the hidden content to disable Components instead GameObjects. Like:
# Tab0.js
function Start() {
for (var c: UIWidgetd in button.GetComponentsInChildren(UIWidgetd)) c.enabled = false;
}
It works, but don't scale, in situations where you create tabs of tabs (or popups with tabs) we will have this problema again.
2) Instead disable, move it offscrean. Smells bad and I will have some problem enabling/disabling Anchors.
3) Broadcast some message after Active to allow any object to disabled again.
NGUITools.SetActive(tab, true);
parent.BroadcastMessage("EnabledAgainHa");
Can someone see a better solution for the problem?