Author Topic: Cant select fonts inside an Atlas  (Read 2079 times)

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Cant select fonts inside an Atlas
« on: March 11, 2014, 06:32:20 AM »
Hi,

I started integrating NGUI in my game and I noticed that I get two draw calls instead of one. I bought the Starlink UI Kit, so I got three UIFont objects: Arimo, Medium and Large. Those three are also integrated into the "Space" Atlas. OK cool, as expected.

But when I chose a font for my UILabels, I cant select the "Space" Atlas and then one of the three integrated fonts. Instead, I am offered the three extra Arimo, Medium and Large font objects. Ergo, I now got two draw calls, one for the Space atlas and one for the font.

Why cant I select a font that is integrated into the atlas?

Also notice the attached screenshot. On clinking "Show All", where NGUI looks for fonts, it seems the old list isn't cleared, thus listing all font objects multiple times.
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #1 on: March 11, 2014, 04:15:32 PM »
What version of NGUI do you have?

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #2 on: March 13, 2014, 06:26:12 AM »
v3.5.3
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #3 on: March 14, 2014, 12:08:09 PM »
That seems very odd. What happens when you use the Show All button?

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #4 on: March 14, 2014, 02:39:25 PM »
This is with Starlink UI imported into my project, opening the Game Scene, selecting "Show Draw Calls", All Panels.
#301224014, #301432336, #302399130

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #5 on: March 14, 2014, 02:41:11 PM »
This is my own project with Show All. I will now see what I get with creating a new project and importing Startlink UI + NGUI fresh.
#301224014, #301432336, #302399130

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #6 on: March 14, 2014, 02:44:19 PM »
Hm, that's pretty much the same. In my own project I added my own sprites to the existing "Space" atlas. But again that might not be the cause, if it's happening on an empty project, too.

New Project, import NGUI 3.5.3 (without examples*), Startlink UI 1.1.5 (full)

* btw I never quite understood why the Controls are under the Examples -> Wooden atlas, which you usually wouldn't import. But thinking about it I guess there's no other way since the object have to use some Atlas
#301224014, #301432336, #302399130

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #7 on: March 14, 2014, 02:48:26 PM »
This is selecting a font in this new project. Initially the menu shows only three items, but hitting Show All doubles the entries to six.

When I close the menu and re-open it again, there are only three entries, but Show All takes it up to six again.
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #8 on: March 14, 2014, 03:52:48 PM »
Yup I see, that's a bug. Harmless, but a bug nonetheless. In ComponentSelector, line 166 is:
  1. if (t != null) list.Add(t);
...it should be:
  1. if (t != null && !list.Contains(t)) list.Add(t);

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #9 on: March 15, 2014, 03:19:16 PM »
Hm, OK, thanks, that is solved.

But my original problem, which was the reason for this thread, remains. I get three draw calls where I expect only one (see screenshots above). All three instances where I use UIFont use the "Large" font that came with the Starlink UI. When I want to select a font, I am offered "Small", "Large" and "Arimo20". On all instances where I use UISprite I use sprites embedded in the "Space" atlas.

In the past I did edit the "Space" atlas that came with Starlink UI and added some of my own sprites. The only thing unusual I notice is that the "Large" font's TextAsset is called "Large_0" (see screenshot). When I edit the "Space" atlas, I can see the three font textures embedded.

When I import NGUI into a empty project and check the Example Controls, which uses a similar setup in terms of multiple fonts inside an atlas, it shows only one draw call.

Does this have to do with where UIPanels are placed? I thought I had a panel on every window aka. tree branch ... but I can check that again ... if it matters.
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #10 on: March 15, 2014, 06:21:32 PM »
If you can't find the sprites in the atlas, then they are in some other atlas. Check where your atlases lie. Maybe you have two atlases with the same name located in different places.

Each UIPanel creates a new set of draw calls. If you have 3 panels, you will have 3 or more draw calls.

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Cant select fonts inside an Atlas
« Reply #11 on: March 16, 2014, 06:26:06 PM »
Hi,

yeah, problem solved. I had to many UIPanels in my scene. Removed them all except the one on UIRoot, and the draw calls are not at 1.

I guess I misunderstood the "one UIPanel per window" paradigm.
#301224014, #301432336, #302399130