Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Wumpee on July 30, 2015, 05:22:59 PM

Title: UIPopupList item labels have a Z depth of -1
Post 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);
Title: Re: UIPopupList item labels have a Z depth of -1
Post by: ArenMook on July 31, 2015, 09:59:25 PM
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.
Title: Re: UIPopupList item labels have a Z depth of -1
Post by: Wumpee on April 21, 2017, 11:33:05 PM
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.
Title: Re: UIPopupList item labels have a Z depth of -1
Post by: Wumpee on April 21, 2017, 11:37:36 PM
Also, using the "On Top" option wasn't working for me. It was offsetting the position of the menu when it popped up.
Title: Re: UIPopupList item labels have a Z depth of -1
Post by: ArenMook on April 22, 2017, 11:51:16 AM
-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.