|
Hi everyone. I have a powerup in my game called crate. When the player collides with it I'm trying to run a function called MachineGun() in my FireScript that increases the bullet fireFreq. When my player collides with the powerup I'm getting a NullReferenceException and I don't know why. In FireScript.js
(comments are locked)
|
|
Try to split your problematic line in 3. That way you can at least identify where the error really are. Like:
(comments are locked)
|

Why aren't you using 'col.gameObject' instead of GameObject.Find? In general, you should avoid using GameObject.Find wherever you possibly can- and I'm not convinced that you need to use it here, either.
Ahh good to know thanks. I had seen the .Find() technique used in a tutorial. Will use the other method from now on.
Much appreciated with the tips guys, solved my health script problem. Thanks again!