Multiple (*) value to position GUI?

Hi

im rewriting my GUI button script to make each button position resolution independent or similiar.
In order to position the buttons in the left part of the screen i divide the the screen.width with a number. To position it on the right side of the middle part of the screen, i do the opposite by decrese the size of the screen width with the size of the GUI button (100) multiplied with two.

private var positionX = (Screen.width) - (dimensionsX *2); 
    private var positionY = (Screen.height / 1.2) - (dimensionsY / 2);

When i deactivate “maximize on play”, and press play and then pause and activate “maximize on play”, and press pause again, i can see the gui button at the right part of the screen. Obviously cause the button cordinates were set according to the smaller screen.
But no mather how mutch i multiply the dimensionX of the GUI button wont change its x position. What am i doing wrong? :shock:

Id have to see a bit more of your code but it seems to me those variables are created at runtime, and are never updated…

the functions update:

function Update () { 

	
	if(Input.touches.Length > 0){
		for(var touch : Touch in Input.touches){ 
			
			touching = Within(touch.position, Rect(positionX, positionY, dimensionsX,dimensionsY));
			if(touching){
				curTouch = touch.fingerId; 
				texture = trycktBild; 
				break;
			}
		}

the OnGUI function:

function OnGUI () {
	GUI.backgroundColor = new Color(0,0,0,0);
	GUI.Button(Rect(positionX, positionY, dimensionsX,dimensionsY),texture); 
	

}

An alternativ is to do like this, but that doesnt work well either. Now the problem is that nomather what value i multiple with dimensionX, and posiiton of the button remains the same.

private var positionX = (Screen.width / 2) + (dimensionsX * 100)

Never mind. I Think i solved it myself. I was specifying the value of dimensionX Y to late.