var X : float;
function Start() {
//Gathering normal object scale x
X = transform.localScale x;
}
function Update () {
if (Input.GetKey("a")) {
transform.localScale.x = X;
}
else if(Input.GetKey("d")) {
transform.localScale.x = -X;
}
}
You’re trying to get the float ‘x’ variable from transform.localScale in the start function. There is a space and not a dot(period) between localScale and x, this is incorrect.
Change this:
function Start() {
//Gathering normal object scale x
X = transform.localScale x;
}
To this:
function Start() {
//Gathering normal object scale x
X = transform.localScale.x;
}