I get the following error on line 4
If the instantiate works fine why would I get null reference ?
even if I simply try to do Debug.Log(ff.name) I get null reference.
foreach (PERSONNEL p in GameControl.control.cities[GameControl.control.cityindex].centralOffice.personnel)
{
GameObject ff = Instantiate(operator_prefab, p.obj_pos, transform.rotation) as GameObject;
ff.name = "ppp";
}
GameObject ff = Instantiate(operator_prefab, p.obj_pos, transform.rotation) as GameObject
when you’re sure about the type the object should be. Then you get the error on the correct line if you’re wrong, rather than later, as you’ve experienced now.