Author Topic: Grid moving to off position  (Read 2083 times)

Ace

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 24
    • View Profile
Grid moving to off position
« on: August 16, 2014, 07:31:40 PM »
Hello

I have a UI Grid object that gets filled up on start up.

I added an anchor to the object and set it to the top left, but it always ends up skewed off position.

I even set the position of the grid to 0,0,0 and it still is offset. The pivot for the UI grid is the top left, but it always moves (aren't objects added to its right side? Why does the grid move?)

This is before



And after



How can I get it to stay anchored to the top left and just have items be added to the right side? Why does the grid move?

It looks like it keeps putting the pivot to the middle even though its set to top left?

I call reposition after I fill the tray, do I need to call anything to fix the anchor?
« Last Edit: August 16, 2014, 10:33:21 PM by Ace »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Grid moving to off position
« Reply #1 on: August 17, 2014, 09:21:40 AM »
The grid's content always extends toward the right and down as you add new items. Pivot setting merely repositions the grid's content afterwards.

I just did a quick test on my end, and the grid's content is what gets repositioned. The grid never moves in my case. I also don't use legacy anchoring however... but even trying that it seems to work fine.

Ace

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Grid moving to off position
« Reply #2 on: August 17, 2014, 09:43:42 AM »
Hmmm

Well there is some weird behaviour.

I will set its position at say 100,100 and have the grid selected before I click play.

It will NOT update or change its transform values in the inspector but it will move in the scene view!


Notice the transform moves to the center and the top left doesn't line up with the blue grind point?
« Last Edit: August 17, 2014, 10:14:40 AM by Ace »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Grid moving to off position
« Reply #3 on: August 17, 2014, 10:06:58 AM »
That's because you have it set to "Center" instead of "Pivot" in the top left corner of Unity.

Ace

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Grid moving to off position
« Reply #4 on: August 17, 2014, 10:14:59 AM »
Thanks!

Ill look into this further!