Author Topic: UI root is becomming 0x0 in size  (Read 5198 times)

CarlosMassiah

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 10
    • View Profile
UI root is becomming 0x0 in size
« on: September 27, 2014, 11:51:45 AM »
I've recently fixed a few textures and replaced some UI textures and now I'm getting an issue where on a couple of my screens the UIRoot is becoming 0x0 - making all the anchoring go wrong.
It only happens when I load from one scene to another. I'm about to go and test a few things to see what is causing it but I'm just checking here in-case anyone knows what causes that off the top of their head.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI root is becomming 0x0 in size
« Reply #1 on: September 27, 2014, 07:18:21 PM »
I can't think of anything in NGUI that would set the UIRoot's scale to zero.

CarlosMassiah

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: UI root is becomming 0x0 in size
« Reply #2 on: October 08, 2014, 03:46:51 PM »
Ok so what is actually going on is anything that is attempting to Anchor to the UI root gets the wrong values. The left right top and bottom goes off to the wrong scale. The scale is off by 1000x's or so.

A simple work around is to anchor everything to the centre, but this looses the ability to scale things properly.
The more complicated work around is to have an invisible Unity gui exture at the edge of the screen and convert it's co-ordinates to the NGUI co-ordinates and set one of your widgets width and height to correspond.

« Last Edit: October 08, 2014, 04:01:01 PM by CarlosMassiah »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UI root is becomming 0x0 in size
« Reply #3 on: October 08, 2014, 04:04:37 PM »
I've had the same thing happen to me, where it seems having something anchored to a panel without a clip rect will "lose" the scaling from the UIRoot and all of a sudden pretend it's globalscale instead (say 960x640, global) so that my background texture gets anchored to +-32000 and stuff in that size. I'm not sure what causes it, but recompiling the code (space in a script and back into unity) tends to fix it. Weird bug.

CarlosMassiah

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: UI root is becomming 0x0 in size
« Reply #4 on: October 09, 2014, 04:20:37 AM »
Which script are you saying to recompile UIRoot?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UI root is becomming 0x0 in size
« Reply #5 on: October 09, 2014, 10:37:47 AM »
Just change something in any script so it triggers a unity recompile and it works fine again. It's the weirdest bug.