Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Wumpee on July 30, 2015, 05:22:59 PM
-
Hi, I was just wondering why the UIPopupList code puts the generated labels at a Z of -1?
I've noticed this causing issues. Some popup lists work, while others don't display their item labels all the time. Some times the labels will vanish the next time you click the popup.
Why is it being set to -1f in this code?
lbl.cachedTransform.localPosition = new Vector3(bgPadding.x + padding.x - lbl.pivotOffset.x, y, -1f);
-
It shouldn't. Its depth is based on the depth of other things you have underneath the widget used to show it.
Current Pro build of NGUI has an option to make popup lists show on a separate panel, ensuring that they are always on top even when used in scroll views.
-
In the latest version of NGUI, line 1043 is set as follows
lbl.cachedTransform.localPosition = new Vector3(bgPadding.x + padding.x - lbl.pivotOffset.x, y, -1);
Setting the -1 to 1 fixes this issue.
-
Also, using the "On Top" option wasn't working for me. It was offsetting the position of the menu when it popped up.
-
-1 means closer to the camera. 1 means farther away. So unless your camera is pointing in the opposite direction, it should remain -1. Doing the opposite means clicks won't work, and the labels will be behind your popup.