Hello 
For my script donjon room generator, i need to calculate the space between the doors of my rooms.
- I need to store in separated var the position of every room.
I have try this but return always 0 :
private var xadresse : float;
private var zadresse : float;
function Update () {
var xadresse = transform.position.x ;
var zadresse = transform.position.z ;
}
function OnGUI ()
{
GUI.Box(Rect(60,200,130,50),"x :" + xadresse);
GUI.Box(Rect(60,250,130,50),"z :" + zadresse);
}
Within your update function, you are creating new variables. Then immediately throwing them away. Do the following:
private var xadresse : float;
private var zadresse : float;
function Update () {
xadresse = transform.position.x ; // Remove var
zadresse = transform.position.z ; // Remove var
}
function OnGUI ()
{
GUI.Box(Rect(60,200,130,50),"x :" + xadresse);
GUI.Box(Rect(60,250,130,50),"z :" + zadresse);
}
The reason for this is you create a new variable each time you use
var so best to only use it once.