At this point I have done and re-done the tutorials on the enemy explosions THREE times now! You know what they say, “Third time’s a charm”, so true! Let me step you through the pitfalls I was experiencing.
First of all, I believe there are two ways to go about setting up the enemy explosions. In the tutorial, Jonathan starts going down one path (I believe to set up an explosion prefab) and then swiftly changes his mind with a signature “Better yet…”, and we end up attaching the explosion to the enemy itself. At this point, with the little that I know, it’s best to go along with the tutorials. Always.
The first problem arose with the renaming of the controller. Even though Jonathan does this in the tutorial, it seemed to create problems for me that he did not have. When I did this, the explosion animation was no longer connected to the controller and my enemies were not exploding despite having followed the tutorial exactly. It’s hard to remember now but I believe that reattaching the newly named controller to the animation did not resolve the problem and I simply deleted both the explosion animation and the controller and started over. That was the first hurdle.
The second issue I had was when I switched from the Animator window to the Scene window and then back to the Animator. All my states were gone! How do you have a controller without states? So after a while of trying to figure out what happened and coming up with no real answer, my team-lead Clyde (shout out to Clyde Carey) suggested I close and restart Unity. Which worked! I was thankful that my game was working again but frustrated that I spent so much time on a problem that didn’t really exist.
Here are my two main take-aways:
- Be extremely cautious about moving, deleting, or even renaming files in Unity. When Unity makes these files they are MADE and are only to be manipulated at a high risk!
- Unity is very glitchy. If something isn’t working correctly remember that Unity itself may be the problem. DO NOT automatically assume it is the code or settings in Unity when it may be Unity herself. RESTART and see if the problem magically disappears.