I get a NullReferenceException error in my last line of code. I’m assuming I’m trying to access the bool in the other script incorrectly, but I don’t know how else to do it.
public class GoList : MonoBehaviour {
public GameObject[] enemyList;
public int enemyListLength;
// Use this for initialization
void Awake () {
enemyList = GameObject.FindGameObjectsWithTag ("Enemy");
enemyListLength = enemyList.Length;
List<GameObject> GObj = new List<GameObject> ();
for (int i = 0; i < enemyListLength; i++){
GObj.Add (enemyList*);*
-
}*
-
GObj.Sort (SortMethod);*
-
foreach (GameObject go in GObj) {*
-
print (go.name); *
-
}*
-
GObj[0].GetComponent<PlayerTurn>().goFirst = true;*
-
}*