As always, if you haven’t already, head over and join our discord to hear about new Dev Diaries as soon as they go up!

https://gph.is/g/aQQzNNx

Is that a Bug?

This time, I thought I’d share a particularly frustrating issue that we ran into recently. After a very productive development push, we eagerly made a new build for the first time in a while. We had overhauled the animations and many of the systems in the game and everything seemed to be going great. When we loaded up the game however, we saw a pretty glaring issue.

The various parts of the player character weren’t layering properly. Sometimes the arms would appear below the body when they should be above it, and other times the body would appear above the head. The perplexing element was that the issue was nonexistent in the editor.

Well darn. This definitely put a damper on our excitement for this new milestone. It seemed like a small issue at first but it made it exceedingly difficult to take screenshots and game play footage that would be usable for very long. On the surface it also felt like a careless mistake, but this issue proved to be pretty difficult to track down.

Bug Spray

Okay. So, now that we’ve found a bug, how do we get rid of the sucker? Issues like this are particularly tricky to diagnose for a few reasons. First, there was not error associated with the issue. The game didn’t seem to think anything was wrong and we weren’t getting anything in our log files. Second, the issue only occurred in the built version of the game. That meant we couldn’t easily change settings on the fly and the turn around time for testing potential fixes was a few minutes at least because the game had to be rebuilt for each test. Finally, we couldn’t find any other instances of similar issues. It seemed like Unity itself was broken.

An example of the simple animation giving us big issues.

Even more perplexing was that our test script seemed to indicate the animation simply wasn’t executing any changes to the sprite renderer’s sorting order. It never changed from the starting layer.

So what did we do? Well, we started tweaking things, one setting at time to test. We started adjusting the import settings for the sprite sheet. We thought maybe something related to the compression of the files post build was preventing the layer order for changing because of some obscure efficiency. No Dice

Eventually, through trial and error we found the culprit. The blending settings in the animator layers were set to additive when they should have been set to override as shown below.

Animation layers are a really useful tool. For 3D animations, the blending setting allows you to blend two separate animations together to create a more complex result. For instance, you can mix a running animation with an aiming animation in an FPS and weight them to the lower and upper body respectively to achieve a really nice animation in unity without any animation experience needed.

We are using animation layers to cleanly manage the different elements of human character animation. This means we can separate the various components into their own animations and mix them as needed, all while synchronizing them with the same animation control variables.

Ultimately we aren’t sure why the issue only appeared in the build. Based on the documentation, Additive seemed like the more appropriate setting and in the Unity editor at least, it worked fine.

Issues like these can take a lot of development time unfortunately, especially for a seemingly small issue.

Takeaways

The best way to handle bugs is a preventative approach. Similarly to preventing bugs of your furry friends, you want to prevent bugs and by checking for them often and eliminating any you find before they become a much bigger problem. Plan out your design before you code, use good coding practices, write tests, and test frequently. A big reason this issue was so hard to track down was because we waited too between builds of the game. The more often we test, the fewer changes there are to check of issues between builds.


Are there any particularly frustrating bugs you’ve encountered? Any hilarious ones? If you’re a developer, what’s the trickiest bug you’ve encountered?

2 Responses

  1. I do QA professionally, and I once encountered a game breaking bug that only happened if you spoke to a particular NPC. I spent over 6 hours trying to narrow down what the problem was before passing it off for a quick fix (character became locked in a state which wouldnt allow swimming to trigger in a later level, which broke spectacularly).

    My FAVORITE bug though was a seemingly random SFX that kept pinging and I couldnt for the life of me narrow down where it was coming from or what was triggering it. Turns out Discord has a notification sound.

    1. Oh my gosh lol! Yep, It’s definitely a real problem to chase something for many many hours and it turns out it wasn’t even an issue at all. Especially when you have been working on the game for days and forget that there are even other things that could be creating sounds!

Comments are closed.