Author Topic: Local position transform of objects in NGUI Grid is always 0  (Read 3927 times)

saldavonschwartz

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
I have a scene where I have a few NGUI UIWidgets laid out inside an NGUI UIGrid. And I notice that once the scene is running and the objects are laid out, even though the inspector shows sensible values for the transform position of each object laid out inside the grid, trying to log the positions thru code always returns a Vector3 with all components set to 0. That is, say, I have a widget inside the grid with position x:-700,y:-180, doing Debug.Log(.transform.localPosition) logs (0.0, 0.0, 0.0).

Any idea what am I doing wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Local position transform of objects in NGUI Grid is always 0
« Reply #1 on: July 26, 2014, 03:44:01 AM »
You are either logging the wrong object (such as position of the UIGrid instead of the child items), or you're doing it before the UIGrid's Start() function, which is where it repositions all children.