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 nicely with Unity and there are tons of tutorials out there on setting it up. Once you do that it’s like a “savegame system” for development. You choose precisely when to make saves, and you can annotate those saves meaningfully, such as “before starting money panel.”
Each commit becomes something where you can compare the differences (in files) from previous to next. For me I like to use source control EXTREMELY frequently, and will make stepwise commits, such as:
- created blank pane for money panel
- connected money panel into main scene script
- created logic to display money in money panel, etc.
Each commit becomes a point that you can trivially teleport back to in time, and make sure something that suddenly stopped working actually was working when you think it was.
I am in the process of converting Jetpack Kurt to run on Android TV. So far it is well over 100 small babysteps towards it, and it is just about done actually.
But with git, at each point in the work process, I can instantly teleport back to it (git is really fast!) and confirm something, revert something, study what went wrong, reason about it, etc. I almost can’t work WITHOUT source control anymore.
Here’s an example of about 30 minutes of work from a few days ago. Each line represents the commit message that I typed free-form when I made the commit, basically comments to myself should I ever have a problem, and I frequently do. I am only human.
These commits list from newest going back in time, so new ones happen at the top. All commits are always kept, every possible saved condition you ever snapshotted with a commit, going back to day 1 on the project.
You can see I was having issues with the input axes getting confused. You can also see me making simple “notes” commit, sometimes to one of my internal “notes.txt” files, or else directly into the code.
git can instantly show me the edits I made to a file… this is the edits for the “am I going insane?” commit for the axis reversal listed above:
You can instantly see how I inverted the axis from + to - and committed the change permanently into history. Red is removed a line, green is added a line, or in this case it is clearly just changes to pairs of lines.
Now if I ever have a question about it, or switch it back, git is tracking an entire history of ALL the changes to every line of every piece of code.
It is unbelievably useful and comforting. And all of my changes are pushed regularly to other computers I own, as well as up to the cloud via bitbucket, github and gitlab private repositories.
If you are super-nerdy, you can also ask git to tell you how many commits you have made. Here is the full count of commits to my Jetpack Kurt game, which I started back on March 18, 2013:
4923```
Update from June 28, 2021: Jetpack Kurt has been under a lot of development in the past year! It's now at:
```kurtina:jetpack kurt$ git rev-list --count HEAD
5782```