Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: ivomarel on April 26, 2013, 04:48:35 AM
-
Dear all,
I have a problem with the new dynamic font, which I am using in both my panels and my main screen. It seems like there can be only one dynamic font in the scene. Even with different TTF's, different GameObjects, I can not manage to have two different dynamic fonts.
Mostly this a problem because of Z-sorting. The text in the main screen is now always in front of my panels.
Any ideas on how to fix this? Or is this actually fixed in NGUI 2.6.0 ? I'm using the dynamic font package right now.
-
The reason the dynamic fonts are in front of the panels is because they have their own draw call so need to be sorted with z position.
-
Hey dlewis,
Thanks for your reply. As I have been trying to adjust the Z-position of my widgets, the problem is that they seem to Z-sort all together. Meaning if I move my UILabel to a higher Z-position, so it's behind the panel all other UILabels (from inside the panel) move as well.
Note: My UI is packed together all in one atlas.
-
If you need to separate a specific group of widgets, give them an extra panel. Like so for example:
Window (panel)
- Background
- Title
- Title Text (z = -1)
-- Child (panel, z = -2)
--- Background
--- Content Text (z = -1, cumulative makes it -3)
-
Yes that worked - Thanks ArenMook!
-
When I attempt to setup my scene like this, the ui elements under the child a panel do not render. The UIPanel says there are widgets and draw calls taking place, but nothing visible. Removing the UIPanel script allows them to render again.
Am I missing something?
-
3D UI? In 3D UIs everything is sorted by distance to camera, and you shouldn't use dynamic fonts/multiple panels at all. 2D UI works correctly.
-
2D ui, and yeah, im using dynamic fonts for my text. So that is likely the issue.
-
If it's 2D, then it should be fine. Keep in mind with dynamic fonts, they are sorted by depth, so you have to move them forward (negative Z).
-
Was running into this even when using z values to sort. Turns out it, that UILabel::MakePositionPerfect is rounding the z value to the nearest int. There should probably either be a disclaimer to use whole numbers for z sorting or just remove pos.z = Mathf.RoundToInt(pos.z);
-
Use whole numbers for z sorting. :)
-
That is great information Nicki! What I'm suggesting is that information exists in the warning messages showed by NGUI. For example, "When adjusting the Z, lower value means closer to the camera." could just have 'use whole numbers' appended to it.
-
You're right and I agree.