I have current code to adjust texture on awake middle of screen. SOME HOW debug says : " 838 8 " . X = 838 and Y = 8 why?
var x : float = Screen.width/2 - (4/2);
var y : float = Screen.height/2 - (4/2);
var Crosshair : GUITexture;
function Awake () {
Debug.Log("" + x +" "+ y);
transform.position = Vector3.zero;
transform.localScale = Vector3.zero;
Crosshair.pixelInset = Rect (x, y, 4, 4);
}
why do you have the 4/2 in brackets? i’m not sure what you are trying to acieve with that, is it the width of your crosshair?
Yes to have texture very middle of screen ( in this case i use DOT ) i will calculate also size of dot to have it middle point.
BUT i solved this, my problem was very easy ( and stupid… ) Notice variables
var Crosshair : GUITexture;
function Awake () {
var x : float = Screen.width/2 - (4/2);
var y : float = Screen.height/2 - (4/2);
Debug.Log("" + x +" "+ y);
transform.position = Vector3.zero;
transform.localScale = Vector3.zero;
Crosshair.pixelInset = Rect (x, y, 4, 4);
}