Hello
i created two java scripts and i wanted to get a variable from the second script which is S2 and modify it in S1
S1 :
#pragma strict
var s2:S2;
function Start () {
s2 = GetComponent.<S2>();
}
function Update () {
s2.rb.useGravity = false;
}
S2:
#pragma strict
var rb:Rigidbody;
function Start () {
rb = GetComponent.<Rigidbody>();
rb.useGravity = true;
}
function Update () {
}
Error :
NullReferenceException: Object reference not set to an instance of an object
S1.Update () (at Assets/S1.js:8)