Hello
I have this simple problem:
on a function, I look for all the instances with the same tag.
Then, I want to access to one of their scripts in order to check a boolean inside.
I always get:
NullReferenceException: Object reference not set to an instance of an object.
any help??
Than you
GameObject[] gos = GameObject.FindGameObjectsWithTag ("NaveProxy");
foreach (GameObject go in gos) {
bool bai = go.GetComponent<naveProxyController> ().isActive ();
if (bai) {
GameObject l = Instantiate (line, transform.position, Quaternion.identity) as GameObject;
l.GetComponent<LineScr> ().setParams (gameObject, go);
l.transform.parent = transform;
}
}