Author Topic: UIAnchor not sticking to the top right  (Read 2644 times)

SilentWarrior

  • Guest
UIAnchor not sticking to the top right
« on: December 03, 2012, 11:33:17 AM »
Hello, I am using NGUI for working on a tool that will either use fullscreen or windowed, and its resizable, it is basically a tool that will monitor a game server, its not a game, but it does need the full power of unity, because its a 3D application that will track players positions and do some heuristics on them to try and find hackers.

Anyways, I am using NGUI for replacing the already made unitygui so it looks better, and I am using the UIAnchor script to try and stick my toolbar to the top right corner of the screen. If i ajust it so that it is correctly placed when I have a smaller window (say editor) and then i put it on a bigger window, instead of sticking to the top right, it will still follow the window resize but at a bigger and bigger distance from it, while the unitygui ones will still stick exactly where they were placed.

Say the window is 400 pixels wide, and the toolbar is placed exactly where it should, if i resize it to be 800 pixels wide, the toolbar will now be 100 or so pixels away from the border, if I resize for 1600 wide, then its 200 pixels away, and this will keep happening, same happens with the top.

My UIRoot has his UIRoot script disabled, the camera under it is set to perspective (default) with added UIOrthoCamera (from the scripts description, it looks like this is the one i would need), then under it there is a UIAnchor set to center (default), then a panel, then another UIAnchor set to top right with default options and panel container set to the parent panel and widget container set to his child (my actual toolbar sprite).


If this is wrong, what would be the correct way of doing this?

SilentWarrior

  • Guest
Re: UIAnchor not sticking to the top right
« Reply #1 on: December 03, 2012, 07:14:24 PM »
It looks like the user gateian is having the same type of problem as I do.

Maybe some more information on this could be added to the documentation?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAnchor not sticking to the top right
« Reply #2 on: December 04, 2012, 02:51:09 AM »
Why would you disable UIRoot? Enable it, and consult the very first example that comes with NGUI. It uses anchors -- many of them -- and in each corner at that.

SilentWarrior

  • Guest
Re: UIAnchor not sticking to the top right
« Reply #3 on: December 04, 2012, 09:53:57 AM »
Right, so if I have an Anchor inside another Anchor then it will bug, but if i remove the top one, it works.