1
NGUI 3 Support / Culling Mask being changed inside NGUI?
« on: March 23, 2015, 02:45:08 PM »
Hey guys, this is driving me nuts, the hole scenario is, I had a really complex UI, with a lot of elements and about 5 cameras.
One of this is responsible for the Alert Popups, like everything else in this UI I'm using a lot of PoolableObjects, so just to get an Idea of what looks like, is something like that:
In my Alert Camera, I had the Event Mask only marked to the Alert Layer, and in my Camera, the same, this is suppose to only render and interact with the Alert Objects.
And in the initiation of this objects from the pool, I do exactly like NGUITools.AddChild, but I do in my own way, to get the object from the Pool:
Now is the strange part, i had a simple button to test this, and keep adding this to the view, and test it out. If i press this button a bunch of times, everything goes perfect, but when I close this Alerts (Pressing the Close button) and try to add a new one, this new one comes from the Pool, and then something strange happen.
My camera lost his Culling Mask, a new UIRoot is created with a new Panel, and from now on, If i remove the new UIRoot, and add one more, the UIRoot is created again.
I do this in mostly every part of the project, but only this one is giving me this problem.
Someone know what can be?
I'm using the 3.8.1 version and Unity: 4.6.3f1
One of this is responsible for the Alert Popups, like everything else in this UI I'm using a lot of PoolableObjects, so just to get an Idea of what looks like, is something like that:
In my Alert Camera, I had the Event Mask only marked to the Alert Layer, and in my Camera, the same, this is suppose to only render and interact with the Alert Objects.
And in the initiation of this objects from the pool, I do exactly like NGUITools.AddChild, but I do in my own way, to get the object from the Pool:
- /// <summary>
- /// Display an decision box with 2 choices
- /// </summary>
- /// <param name="title">title of the screen</param>
- /// <param name="content">Target text to be displayed</param>
- /// <param name="button1Label">Label of the button 1</param>
- /// <param name="button2Label">Label of button 2</param>
- /// <param name="button1Callback">Callback for the button 1</param>
- /// <param name="button2Callback">Callback for the button 2</param>
- /// <param name="showOverlay"></param>
- /// <returns></returns>
- public static DecisionAlert ShowDecision(string title, string content, string button1Label, string button2Label, Action button1Callback, Action button2Callback, bool showOverlay = true)
- {
- DecisionAlert alert = ObjectPoolController.Instantiate(Instance.AvaliableAlerts[(int)AlertTypes.Decision].gameObject).GetComponent<DecisionAlert>();
- alert.transform.parent = Instance.ContentTable.transform;
- alert.transform.localScale = Vector3.zero;
- alert.transform.localPosition = Vector3.zero;
- NGUITools.MarkParentAsChanged(Instance.ContentTable.gameObject);
- alert.Init(title, content, button1Label, button2Label, button1Callback, button2Callback);
- if (showOverlay)
- {
- ShowOverlay();
- }
- Instance.m_activeAlerts.Add(alert);
- return alert;
- }
Now is the strange part, i had a simple button to test this, and keep adding this to the view, and test it out. If i press this button a bunch of times, everything goes perfect, but when I close this Alerts (Pressing the Close button) and try to add a new one, this new one comes from the Pool, and then something strange happen.
My camera lost his Culling Mask, a new UIRoot is created with a new Panel, and from now on, If i remove the new UIRoot, and add one more, the UIRoot is created again.
I do this in mostly every part of the project, but only this one is giving me this problem.
Someone know what can be?
I'm using the 3.8.1 version and Unity: 4.6.3f1