- Home /
Detonator -- Null reference error when adding component to empty game object
I'm getting the following null reference exception when adding detonator to an empty game object...
NullReferenceException DetonatorFireball.UpdateFireShadow () (at Assets/Standard Assets/Detonator/System/DetonatorFireball.cs:159) DetonatorFireball.Explode () (at Assets/Standard Assets/Detonator/System/DetonatorFireball.cs:195) Detonator.Explode () (at Assets/Standard Assets/Detonator/System/Detonator.cs:335) Detonator.Start () (at Assets/Standard Assets/Detonator/System/Detonator.cs:278)
To get the above error, all I did was (exactly as described in the Detonator document)... 1. Add an empty game object to my scene. 2. On the new game object, select Component->Detonator->Detonator from the main menu.
This adds the main Detonator script to the empty game object, but with "explode on start" set I get the above error when first running the game.
Is there an additional package that I need to import, or perhaps an additional component that I need to add to the empty game object to get this to work?
The test scene that comes with the detanator package works fine.
Answer by Ronald · May 19, 2011 at 08:35 AM
You can solve this by giving your camera the following tag: MainCamera
Passer by here. Could you explain why this works? You really helped me but I couldn't but help but notice the Detonator class never mentions a camera or a tag even once. Just curious :)
Answer by RolfBertram-com · Apr 27, 2011 at 11:52 PM
You might want to try importing the detonator package directly from the asset store into an EMPTY project. Test in your empty project. From there, export it again, and import into your working project. I had several times that importing into existing projects was missing several assets for unknown reasons, but importing into an empty project, and exporting again from there, works.
Your answer
Follow this Question
Related Questions
How to use Explosion/Detonator Framework 3 Answers
Trouble with Detonator 2 Answers
"Simple State Saving" problem. 1 Answer
accessing a variable from another script. 3 Answers
Help with NullReferenceException 2 Answers