In the course of developing my little shooter project, I’ve found that animation is updated slightly differently on the mac vs. pc. The only reason I’ve been able to spot these differences is because I’m using the combined information of (A) user input and (B) the current time/weight of various animation clips to decide what animation happens next, and sometimes the same logic behaves differently on mac than on pc.
Here’s an overview of what my code looks like under the hood. I have an ‘animState’ integer that essentially tells us what the player is trying to do. 0 is idle, 1 is run, 2 is aim, and 3 is firing so far.
But rather than just saying “if animState = 1 then play run animation”, I do a series of checks first… such as “if animState = 1 and the idle animation’s weight is greater than 0, then crossfade the idle-to-run transition” along with “if the idle-to-run transition’s normalized time is > 0.8, and animState is still 1, then crossfade the run loop”. It may seem a bit convoluted, but its been working great so far and it’s fairly easy for me to understand and tweak from the perspective of an animator.
So here’s where I first noticed it falling apart - my ‘bullet firing’ function was set to trigger ONLY when the firing animation was at a normalized time of 0 and the animState is 3. Within that bullet firing function was a command to instantly play the firing animation, spawn a visual effect, and a shell casing prefab. This was all within the ‘update’ function, so by the time the next update came around, the normalized time would no longer be 0 and I would only trigger the function once. This worked perfectly on Mac, each time the animation was rewinded a single round was fired.
When I went to test this on PC however, the same exact logic would cause TWO shots to be fired simultaneously the first time you clicked. Two shell casing would pop out, two muzzle flashes… Somehow on PC, the normalized time for the fire animation was NOT advancing immediately upon being told to play. I worked around this by just making the firing function also advance the animation’s normalized time by a microscopic fraction.
This isn’t the only case of such animation-driven logic failing to evaluate the same way on both platforms. There have been a few other cases similar to this, where it seems like the normalizedTime and weight of an animation does not change in the same order on mac and pc.
I’d be interested to hear if the developers have even the foggiest idea of how this could occur?