I am very worried something is corrupt in my project. I am making a 2d top-down rogue-like and am currently using prefabs to generate enemies from. I have started running into an issue where I get a null reference error when trying to iterate a collection of enemies after doing anything on the prefabs, even just selecting one in the editor. If I drag any of the enemy prefabs into the scene then immediately delete it I am fine until I touch a prefab in the inspector again. at one point I was getting "iHasError" 6 times with no info but the unity reinstall fixed that so far

I have tried:

•Deleting the library folder
•Doing a Reimport All
•Uninstalling and reinstalling Unity
•Reloading the project from a few days ago
•Removed a bunch of animations added this weekend
•Commenting out everything I had done recently in the Enemy script
•Googled for a couple hours and looking for things that seem similar

My prefab is structured:

•Sprite Renderer
•Enemy (Script) About 500 lines
•Animator (simple 2-sprite swap animation)

Does anyone have any ideas?

Mike B

  • \$\begingroup\$ Unity 5 is so buggy atm... I've been having issues with the animation window and the scripts in my project view. For some reason I can't even rename a script after its created :s constantly reverts itself back to the original \$\endgroup\$ – Savlon Jun 29 '15 at 15:01
  • \$\begingroup\$ After further troubleshooting I have found this only happens if the prefab is tagged (I tag them "Enemy" so I can build a collection in code \$\endgroup\$ – Mike B Jun 29 '15 at 15:20
  • \$\begingroup\$ Send unity a bug report \$\endgroup\$ – Savlon Jun 29 '15 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.