NullReferencException on Int array

So i’m trying to create basically a Bullet Hell game from scratch. So i’m making my code which will allow me to make multiple bullet emitters, then spread them out equally automatically along however wide I want the emitters to spray their shots. However whenever I iterate my array on my for loop, I get a Null Reference Exception.

	public int numberOfEmitters = 5; 
	public int emitterWidth = 30; //size of the angle (degrees)
	private int[] emitterDir; //Array

	void Start(){
		for(int i = -1; i < numberOfEmitters; i++){
			if (i > -1){
				//Debug.Log ("Emitters #: " + i + " : Angle : " + (((emitterWidth * 2)/numberOfEmitters * (i + 1)) - emitterWidth));
				emitterDir[(i + 1)] = (((emitterWidth * 2)/numberOfEmitters * (i + 1)) - emitterWidth);
			}
			else{
				emitterDir[(i + 1)] = -emitterWidth;
			}
		}
}

So am I doing something wrong? Do I need to change my equation?

emitterDir isn’t initialized anywhere

Assuming this is all of your code, as Jessespike said you are not initializing your array.

private int[] emitterDir; //Array

You need to do something like

private int[] emitterDir = new int[numerOfEmitters]; //Array

keep in mind that I’m guessing that this is all the relevant code, and that this is your intent with the array.