using UnityEngine;
using System.Collections;
public class enemySpawner : MonoBehaviour {
private int c;
private Vector3[] spawnPoints;
void Awake() {
BoxCollider b = gameObject.collider as BoxCollider;
for (int x = 0; x <= b.size.x; x++) {
for (int z = 0; z <= b.size.z; z++) {
spawnPoints
= new Vector3(x, 0, z); //this is where I get the error
c++;
}
}
print(spawnPoints);
}
}
And the full error:
NullReferenceException: Object reference not set to an instance of an object
enemySpawner.Awake () (at Assets/Scripts/enemySpawner.cs:14)
What am I missing? As far as I can tell, the code is correct. I guess C# is just extremely picky. I'm sure this is a very easy fix, thanks in advance.