Those values don't make much sense to me as they seem to have different origin points.
"Left" anchored to the left is very different from "Right" anchored to the right. Otherwise I don't see why left is positive and right is negative. If you want the two panels to hug each other, just ensure that they both use the same anchor point. That is, if one is anchored to the window's left side, the other one should also be anchored to the window's left side. It's often easier to use "Center" because of this.
Right but I need to anchor the panels to Left, Right, Bottom, Top to get them scaled to the correct resolution on the device it's running on since the UI has to be full screen on all resolutions. So like I said i'm currently testing on iOS on iPhone 4 and iPhone 5 resolutions. Since the UI in based on an iPhone 5 resolution I had to figure out how NGUI scales the UI to the correct size on iPhone 4. I've done it manually to test out how the anchoring positions should be. Keep in mind that i'm using Widget containers to TweenPosition the whole UIPanel (Screen) at once:
For iPhone 5Left: 910
Right: 371
For iPhone 4Left: 1029
Right: 490
So i've made this script:
using UnityEngine;
using System.Collections;
public class SetAnchorPosition : MonoBehaviour {
private float width;
private float height;
private UIWidget container;
private void Start()
{
width = Screen.width;
height = Screen.height;
container = this.gameObject.GetComponent<UIWidget>();
SetAnchorPos();
}
//Sets the anchor positions to the correct value for each resolution
private void SetAnchorPos()
{
if(Screen.width == 1080 && Screen.height == 1920)
{
}
else if(Screen.width == 720 && Screen.height == 1280)
{
}
else if(Screen.width == 640 && Screen.height == 1136)
{
container.leftAnchor.absolute = 910;
container.rightAnchor.absolute = 371;
}
else if(Screen.width == 640 && Screen.height == 960)
{
container.leftAnchor.absolute = 1029;
container.rightAnchor.absolute = 490;
}
else if(Screen.width == 540 && Screen.height == 960)
{
}
else if(Screen.width == 480 && Screen.height == 800)
{
}
}
}
Basically what this script does, is it sets the correct anchor positions for the panels which are offscreen and always on the left side of the first screen (like the picture in the first post).
I attach this script to each container with a UIPanel in it. What I would like to know is how NGUI calculates the Left and Right anchor position based on the screen resolution so I can calculate them for each resolution i'm targeting.