So I have read some of the same question, and it’s said that it’s caused by #pragma strict where I should init var in Awake or Start. But my problem is, so…
This is my code before and it’s working fine
#pragma strict
var aa : SomeType;
var bb : OtherType;
var dd = "start";
var ee = "pause";
Then I add
#pragma strict
var aa : SomeType;
var bb : OtherType;
var xx = transform.position;
var yy = transform.rotation;
var dd = "start";
var ee = "pause";
That error happened, so after searching here and there, I changed it to:
#pragma strict
var aa : SomeType;
var bb : OtherType;
var xx : Vector3;
var yy : Quaternion;
var dd = "start";
var ee = "pause";
function Start() {
xx = transform.position;
yy = transform.rotation;
}
Error sticked.
Then I removed the xx and yy from all places and it went back to the first code, error still sticked, eventho before it’s running. So I restarted Unity and MonoDevelop, error’s gone and code running smoothly even after being added with var xx and yy like in the third code. Why did that happen?