Author Topic: Problems with the drawing of sprites  (Read 6046 times)

Chris_Entropy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Problems with the drawing of sprites
« on: January 17, 2014, 12:02:17 PM »
I am currently having problems with some sprites in my GUI. My Setup in the scene looks something like this:

UIRoot
-UIWidget (a Container for the Window)
--UIScrollView
---UIWidget (a container to position the grid elements correctly)
----UIGrid

I then instantiate in a script objects with the following structure:

UIToggle
-UILabel
-UILabel
-UISprite (overlay for active toggle)

and parent it to to UIGrid in the Structure above. The sprite is the overlay for the toggle element when it is activated.

The problem now is, that when I instantiate several objects, only the toggle sprite of the first object is shown. The others are invisible. When I click on the Sprite in the inspector, I can see, that the sprite alpha is updated correctly. So the toggle works, but the sprite is rendered behind the background as it seems.
Now the interesting part. While the game is running, when I change the z-value of the toggle overlay Sprite transform, the sprite appears. It is irrelevant, to what value it is set, and I can reset it to the old value after doing so. It also works, when I change the z-value of the parent toggle widget.
I already tried to to set the z-value of the sprite to a negative value on the prefab, but this didn't change anything. I also checked the depth values, but I don't even have a background sprite which could be overlapping my overlay sprite. This is really mysterious.

I am using Unity 4.3.1f1 and NGUI 3.0.8 f7
Any ideas?

AtomicBob

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 69
    • View Profile
Re: Problems with the drawing of sprites
« Reply #1 on: January 17, 2014, 12:57:35 PM »
It's hard to get a clear idea of what's going on from your description. It sounds like it may be the same or a similar issue as the one I'm experiencing. A few questions:

  • What is your Render Q setting on your UIPanel?
  • What are the z-values and depths of the background and instantiated UIWidgets?
  • When you instantiate the prefab multiple times, are they all using same depth? This can cause problems if they overlap at all.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problems with the drawing of sprites
« Reply #2 on: January 17, 2014, 02:34:43 PM »
Known issue, should be fixed in tonight's update.

Chris_Entropy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Problems with the drawing of sprites
« Reply #3 on: January 18, 2014, 08:03:16 AM »
Thanks for the fast answer, will check out the update later.

Chris_Entropy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Problems with the drawing of sprites
« Reply #4 on: January 23, 2014, 10:23:02 AM »
Cool, this solved it :)