I’m sorry you’ve had this issue. Please consider using source control in order to guard and protect your hard-earned work.
Personally I use git because it is free and there are tons of tutorials out there to help you set it up.
Here’s how I use git in one of my games, Jetpack Kurt:
Yeah, what Praetor said is it… Debug.Log is your friend, and also since this is animation related, you can open up the Animator window when you expect the animations to go, and actually visually see where the state machine is, see which state it thinks it is in. You can combine this with Debug.Log() output at the locations where you set the animations to be what you think they should be, and that should lead you to some intel.
I highly recommend setting up git source control. It really plays ni…
Using fine-grained source control as you work to refine your engineering:
This is a reasonable initial approach. The problem is you have listed the parts, but you haven’t really listed how they interact, and even if you did, it’s still sorta up to you how to organize it.
Only YOU will know how to organize it, and the only way you can tell is to do the work.
I recommend this: first, develop ALWAYS with source control (such as git), and every time you get even the slightest thing working, commit those changes with good commit messages.
Then move to the next thing, c…
Share/Sharing source code between projects:
I have found that bundling your own code into DLLs only serves to slow down your workflow. I base this on several years of experience dealing with other teams well-intentioned packaging mishaps. With games, it is almost always useful to reach into library code, make a temporary tweak to isolate a problem, and then revert it. With DLLs this is impossible, making workflow harder and more brittle.
I prefer to share source code at the C# level. That way I can reach into libraries trivially and inje…
Setting up the right .gitignore file:
Not sure what you are "auto generating" with... I usually start from one of my other projects, or a gitignore example online, and reason about all the parts inside it, and start from there. Like any other configuration change, after you make it, pay attention for a while to make sure it is what you want.
You can always clone the repo somewhere else to verify that the correct files are being tracked. Doing so to a brand-new computer is the acid test to make sure you can still bui…
Now odds are it’s only something trivially out of place, but GET YOUR PROJECT BACKED UP NOW FIRST!
Finally, to investigate errors above, after you have backed up your project:
Some notes on how to fix a NullReferenceException error in Unity3D
also known as: Unassigned Reference Exception
also known as: Missing Reference Exception
also known as: Object reference not set to an instance of an object
http://plbm.com/?p=221
The basic steps outlined above are:
Identify what is null
Identify why it is null
Fix that.
Expect to see this error a LOT. It’s easily the most common thing to do when working. Learn how to fix it rapidly. It’s easy. See the above link for more tips.
This is the kind of mindset and thinking process you need to bring to this problem:
Let me take you step by step through it.
You see the error line, line 35?
The only possible thing that could be null in that line is audio_BGMusic
So that's part 1. That's what's null. We identified it.
Part 2... WHY is it null? Well, first we start with "who is supposed to make it not null?"
Looking up further I see line 19 sets it, with this construct:
audio_BGMusic = ObjectMusic.GetComponent<AudioSource>();
So lets take that apart. How can that fail? We have to suppose it DID fa…
Step by step, break it down, find the problem.
When you have identified more where the problem is, here is how to get help in the forums:
How to report your problem productively in the Unity3D forums:
http://plbm.com/?p=220
How to understand compiler and other errors and even fix them yourself:
Errors are there to help you. It’s a good idea to try and learn how to understand them. Try to apply the breakdown in this post of your original error to the new error you’re receiving. If you don’t understand a word, don’t just gloss over it. Ask what the word means here, or research it elsewhere. Cultivating a habit of research will pay dividends for you in every part of your coding journey.
Here’s a breakdown of your specific error, but try applying this process to any other error you may en…
If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly