|
I am working on a projectile manager for my 2D space shooter iPhone game. And im trying at the start off the level make a array with all the ProjectileController script that is attached to the projectile gameobjects. But i get a NullReferenceException error on the line in the second for loop. How can i make this function work? Or is there a better way of achiving what im trying to do?
(comments are locked)
|
|
It looks like the projectilesArray is not initialized to anything, so when you try to access the i'th element it doesn't like that. Also, you can use the "clone" return value to get the component right there, e.g.
(comments are locked)
|

Did you initialise the array?
There isn't any more code concerning the array then what i posted here, so i guess not. How do i do initialize it?