Class Design and Level Objects

I am making a music game, which each level is based on 5 notes. I wanted the level class to be initialised with an array of 5 notes, to allow them to be displayed one at a time in a random order. Also I wanted each note to be instantiated with different positions and names.

One of the problems was that I couldn’t create a new ‘note’ with the ‘new’ keyword, and if I used the return value of Instantiate() it would initially display all 5 notes at the same time.

I’m not used to the relationship between gameobjects and scripts in unity yet, please can you give me some advice the best way to design my classes for unity in this situation?

Thanks

Could you post your current code?

Right now I’m just doing this in the level class

numNotes = 5;
		noteArray = new GameObject[numNotes];
		

		GameObject newENote = Instantiate(NoteObject) as GameObject;
		Enote = newENote.GetComponent("Note") as Note;
		Enote.Position = new Vector3(2.1f,0.90f,-0.67f);
		Enote.Name = "E";
		noteArray[0] = newENote;
		
		
		GameObject newGNote = Instantiate(NoteObject) as GameObject;
		Gnote = newGNote.GetComponent("Note") as Note;
		Gnote.Position = new Vector3(2.1f,1.03f,-0.67f);
		Gnote.Name = "G";
		noteArray[1] = newGNote;

etc… :face_with_spiral_eyes: