I am in the process of changing over my game to use Mecanim and have one issue remaining. Previously with the legacy animation system I started animations at a random point for groups and crowds so that animations were not synced up.
This was easy to accomplish using the following code:
This works to start an animation, but what if the animation is the default, such as idle, i.e. an anim the characters will return to after finishing moving etc? 5 characters running together will then go back to standing still at pretty much the same time (or, exactly the same time, if doing a turn-based game) and I would like to avoid doing a hard cut back to idle via code, upon finising moving, as oppose to set the state-flag as per usual. What is the approach then? Any way to set a different start-location of a looped animation per character?
Here is a code snippet I use that randomizes the start time with a public bool at awake. That way you can easily tweak whether it should be randomized or not.
Been meaning to update this. This functionality was added when ForceStateNormalizedTime was deprecated.
– thraxSTThis works to start an animation, but what if the animation is the default, such as idle, i.e. an anim the characters will return to after finishing moving etc? 5 characters running together will then go back to standing still at pretty much the same time (or, exactly the same time, if doing a turn-based game) and I would like to avoid doing a hard cut back to idle via code, upon finising moving, as oppose to set the state-flag as per usual. What is the approach then? Any way to set a different start-location of a looped animation per character?
– Zarkow