Author Topic: UILabel not displaying when parent transform moved through code...  (Read 4728 times)

Gregzo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 64
    • View Profile
Hi!

Massively upscaling my project thanks to NGUI, awesome!

One strange thing : I have a UISprite and a UILabel both parented to the same object, UILabel.enabled = false.
From a script attached to the UISprite, I do transform.parent.localPosition.y += 10 , then uiLabel.enabled = true.

The transform moves, the children move along, but the label doesn't show. It is enabled allright, simpy doesn't display.

If I don't move the parent through code, but in the inspector, and then manualy enable the label, all is fine.

Hummm...

Thanks for any insights!

Edit : both uiLabel and Sprite are displayed on top of another UISprite. Just found out that my hding label went behind. But no matter how I adjust depth and z, can't get it to show after it's parent has been moved through code.

Edit 2 : sprites and label are in 2 different atlases. adjusting label's z doesn't help...
« Last Edit: June 26, 2012, 07:02:22 AM by Gregzo »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

Gregzo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 64
    • View Profile
Re: UILabel not displaying when parent transform moved through code...
« Reply #2 on: June 27, 2012, 02:35:14 AM »
Thanks, problem solved.

To sum things up : don't use different atlases in the same panel.

Cheers!