Animancer v7.2 uses AnimationPlayableUtilities.Play to tell an Animator component to play its PlayableGraph but Unity 2022.1 has marked that method as [Obsolete] so it gives a compiler warning.
The Solution
That method actually still works as intended so you just need to suppress the warning. Double click the warning in the Console window to open AnimancerPlayable.cs and put a warning suppressor around the call:
#pragma warning disable CS0618 // Type or member is obsolete.
AnimationPlayableUtilities.Play(animator, _RootPlayable, _Graph);
#pragma warning restore CS0618 // Type or member is obsolete.
See the difference? The new example calls SetTimeUpdateMode(DirectorUpdateMode.GameTime) which makes the graph update using regular game time as you would expect from animations most of the time.
Sometimes you might want to ignore Time.timeScale and there's a DirectorUpdateMode for that too.
But what if you want the graph to update using the fixed timestep (in time with FixedUpdate and physics updates) like if you set the Animator's Update Mode to Animate Physics? Well that's too bad, you can't because there's no mode for that. The only way I know of to get the graph to update using the fixed timestep is to set the Animator's Update Mode and call AnimationPlayableUtilities.Play which calls SyncUpdateAndTimeMode. You can't call SyncUpdateAndTimeMode directly because it's internal and it didn't even seem to work when I tried calling it using reflection.
So yeah, they just deprecated a feature that works 100% as expected and has no alternative. I'll report a Unity Bug and hope they un-deprecate it (or better yet, add DirectorUpdateMode.FixedGameTime).
The Problem
Animancer v7.2 uses
AnimationPlayableUtilities.Play
to tell anAnimator
component to play itsPlayableGraph
but Unity 2022.1 has marked that method as[Obsolete]
so it gives a compiler warning.The Solution
That method actually still works as intended so you just need to suppress the warning. Double click the warning in the Console window to open
AnimancerPlayable.cs
and put a warning suppressor around the call:That's Not A Solution
Well the documentation page for AnimationPlayableUtilities.Play gives a solution:
But if you decompile the
AnimationPlayableUtilities.Play
method you get this (I used IL Spy):See the difference? The new example calls
SetTimeUpdateMode(DirectorUpdateMode.GameTime)
which makes the graph update using regular game time as you would expect from animations most of the time.Sometimes you might want to ignore
Time.timeScale
and there's aDirectorUpdateMode
for that too.But what if you want the graph to update using the fixed timestep (in time with
FixedUpdate
and physics updates) like if you set theAnimator
'sUpdate Mode
toAnimate Physics
? Well that's too bad, you can't because there's no mode for that. The only way I know of to get the graph to update using the fixed timestep is to set theAnimator
'sUpdate Mode
and callAnimationPlayableUtilities.Play
which callsSyncUpdateAndTimeMode
. You can't callSyncUpdateAndTimeMode
directly because it'sinternal
and it didn't even seem to work when I tried calling it using reflection.So yeah, they just deprecated a feature that works 100% as expected and has no alternative. I'll report a Unity Bug and hope they un-deprecate it (or better yet, add
DirectorUpdateMode.FixedGameTime
).