Our game is down to just polish now, so we are focusing on making everything be as good looking and bug-free as possible. One of the issues I mentioned last week was that for some reason unity refused to change the color of game objects which had an Animator attached to them. Luckily I found a way to remedy this problem.
While Unity refused to change the regular R, G, B settings of the color of the object, bizarrely enough, it still let me adjust the alpha on the object. So, after some thinking, sleeping, eating and procrastinating, I figured out a cheap but somewhat effective solution on what to do. In reality, all I needed was the object to go from black to white, to show it’s distance in the background. That’s when it hit me, all I could do is just create another object, that’s black at the same position.
I decided to run this through code for all of the moving objects in the background to create a child object, with a sprite renderer that has the same image as their parent. After that I locally move their z position just slightly to make sure they are always behind their parent. When it came down to the colors, I made sure that no matter what, the parents are always full white color and the children are in full black color, right before the Animator object got attached, since the color won’t change until I disable the Animator.
With all of that in mind, all I had to do was a few small changes to the code to make it so that the child’s alpha fades in first in the background, and afterwards the parent. This gave the fake illusion that it’s the same object just going from Black to White. I’m still not sure what the real issue is with Unity when it comes to this. I have some idea that it’s probably the animations somehow trying to alter the colors of each frame manually, but I digress. I’m just glad I was able to find a sort of “ghetto” solution for this, before release.