Author Topic: UISprite not displayed over Widget  (Read 8571 times)

Isamson

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 52
    • View Profile
UISprite not displayed over Widget
« on: August 08, 2014, 10:58:15 AM »
Hi Guys, I don't know if any of you experienced this problem but I really need a solution.

I have a panel that I hide and move out of the way when it's not needed. Within that panel is a grid where I generate prefabs. These prefabs are updated every time I display the panel. The first time the panel is displayed, every sprite is in the right spot but if I popup the panel again, the sprites texture is not aligned with the widget (see attached picture)

The only way to display the sprite properly is to update some value that will force it to refresh (scale, position, etc.)

Any help would be appreciated.
Unity 4.5.3f
NGUI 3.7.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprite not displayed over Widget
« Reply #1 on: August 08, 2014, 05:12:11 PM »
You'll need to provide more to go on here. Showing or hiding a panel doesn't move its content. Is it a scroll view? It it scrolled? How is the updating done? Do you run Execute() on the grid? How do you remove items from it? (use NGUITools.Destroy)? Do you have any game objects that have more than one widget, or a widget and a panel on it?

Isamson

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 52
    • View Profile
Re: UISprite not displayed over Widget
« Reply #2 on: August 11, 2014, 07:59:32 AM »
Sorry  about the lack of information. Here is the hierarchy:

- offset
   - UIPanel
      - UIGrid
         - Gameobject_01
            - TweenScale
               - UILabel
               - UILabel
               - UILabel
               - UILabel
               - UISprite
         - Gameobject_02
         - Gameobject_03
         - ...

- Neither of these objects have more than 1 Widget.
- there is no scrollview (yet)
- it is not scrolled.
- I add to the list by instantiating prefabs to the UIGrid. To remove object, I simply hide then (go.SetActive(false);
   Once the objects are added or hidden, I set the Reposition variable to "true" .
- No panel has a widget on it.
- When I hide the panel, I move it's parent to (-5000, -5000, 0)
- My panel uses "Soft Clip" with a value of 4

Oh! and this panel is a child of another panel (don't know if this could cause problems)

I just ran a test and not using the UIGrid Reposition system fixes this problem. Maybe moving the uipanel parent and running UIGrid repositioning at the same time is causing the problem.
Unity 4.5.3f
NGUI 3.7.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprite not displayed over Widget
« Reply #3 on: August 12, 2014, 03:35:13 AM »
I remember there used to be an issue related to enabling something then quickly moving it a couple of months ago... are you on the latest version?

P.S. It's best to call Reposition() instead of setting the boolean.