Released 2022-07-03
See the Animancer v7.0 Upgrade Guide if you're upgrading from a version older than that.
Features
- Made
StateMachine<TState>
and its children[Serializable]
.- The Serialized Fields pattern is now the recommended way of setting up a state machine in most situations.
- Added
ICopyable<T>
to standardize types with aCopyFrom
method.- Added
AnimancerUtilities.Clone
as an extension method. - Implemented that interface in all Transition Types. #195
- Added
- Added
AnimancerTransitionAssetBase.UnShared
which is an UnShared class that can have any type of Transition Asset assigned to it (instead of only a specific type). - Improved the Pack Textures window:
- It will now re-pack
Sprites
that were already packed into textures so that wasted space in the original textures doesn't affect the new packing. - Fixed several bugs with specific input asset configurations.
- It will now re-pack
- Added the ability to specify an environment prefab in the Transition Preview Window via its Settings tab. #199
Examples
All Examples
- Improved the information blocks at the start of each example:
- Removed Difficulty because calling them "Beginner" or "Intermediate" wasn't a very useful distinction.
- Removed Namespace because that isn't important information and the example scripts don't have detailed comments so linking to the namespace's API page wasn't useful either.
- Recommended After is now a key point (previously is was included on the same line as Difficulty).
- Added Learning Outcomes to outline what you are expected to learn from that example so that if you feel you haven't learned something by the end you can re-read it or ask for Help.
Old | New |
---|---|
- Added code architecture diagrams to all examples.
- Added support for the new Input System Package in the examples (as well as the legacy Input Manager).
- Added a Humanoid-PistolShoot animation and a Pistol model for various examples.
- Cleaned up the Humanoid-Walk, Humanoid-Run, and Spider Bot animations a bit.
- Removed the GolfPutt and Tennis animations and models.
- Cleaned up all example UI canvases.
- All example objects now have materials so they can get properly updated by SRP (because apparently the default material can't).
- Fixed example scene lighting to use a Spot Light instead of Directional because it's attached to the camera and having a continually moving Directional Light was causing warnings in Unity 2022.
Specific Examples
- Basics completely remade everything:
- Quick Play now only covers the scene setup and plays a single animation on startup.
- Basic Movement swaps between Idle and Move animations based on whether a key is being held.
- Basic Action performs an Action when the user clicks the mouse and then returns to Idle.
- Transitions implements the same logic as Basic Action but with Fading between animations.
- Basic Character combines Basic Movement and Transitions to explain some of the issues that arise when you start implementing more complex behaviours.
Playing and Fadinghas been removed since its important points are now covered by Transitions.- Moved
Named Animationsto the Fine Control group since it isn't necessary to understand how to use Animancer and isn't a recommended workflow.
- Fine Control:
- Renamed
Spider BottoSpeed and Time.- It no longer involves inheritance since it was confusing for beginners.
- Instead, it uses a
[SerializeReference]
for its Move animation so that the Polymorphic Drawer system can allow the Directional Mixers to reuse the same script with a 2D Mixer.
- Greatly simplified the
OnValidate
method in Doors.
- Renamed
- Directional Sprites:
- Renamed
Basic Movementto Directional Basics. - Renamed
Character Controllerto Directional Character.
- Renamed
- Events:
- Changed
FootstepEvents
to besealed
and haveFootstepEventsAnimation
reference it with a field instead of inheriting because it was confusing to beginners. - Simplified Golf Events to only contain one character demonstrating hybrid Animancer Events instead of also re-explaining the regular ways of using each system that were already explained in Footstep Events.
- Changed
- State Machines completely remade everything:
- Removed
Game Manager. It was supposed to be a short introduction to demonstrate how Animancer's FSM could be used for a non-animation situation, but it ended up being way too long by explaining all the other irrelevant details like enums, switches, camera movement, text formatting, etc. so now Characters does the job much better anyway. - Removed
Brain Transplantsbecause it spent far too long explaining things that weren't directly relevant to Animancer or even how to use the FSM system. - Renamed
Interrupt Managementto Interruptions. - Completely replaced Characters to re-implement the same behaviour as Basic Character using Animancer's Finite State Machine.
- Changed Brains, Interruptions, and Weapons to directly reuse the same scripts from Characters instead of having their own slightly different copies. This just means the Characters scripts have some parts which aren't explained until later example.
- Included an example scene for Weapons. It isn't very good since the example animations are limited, but it works as a proof of concept while the documentation shows what it could look like with a proper character and animations.
- Removed
- Layers completely remade everything:
- Split the old example into two which are based on the behaviour of Basic Character instead of using UI buttons.
- Basic Layers for playing and masking.
- Dynamic Layers for playing the Action on the whole body if the character would be Idle or just the upper body while they Walk.
- Animator Controllers:
- Replaced
Hybrid Mini Gamewith Hybrid Character which re-implements the character from Brains to include an Animator Controller avoids wasting so much time explaining irrelevant behaviour. - Cleaned up 3D Game Kit and changed it to use a Serialized State Machine.
- Replaced
Improvements
- The Layer header is no longer shown in the
AnimancerComponent
Inspector when there's only one and has all default values. This can be disabled as a Display Option. - Added
OptionalWarning.LockedEvents
.- Added
AnimancerEvent.Sequence.ShouldNotModifyReason
andSetShouldNotModifyReason
. - When a Transition is played it calls
SetShouldNotModifyReason
to explain that modifying the events on a state played from a Transition is a common source of bugs. - When an
AnimancerEvent.Sequence
is modified, if itsShouldNotModifyReason
has been set, it logsOptionalWarning.LockedEvents
(with the reason included in the warning message). - The
AnimancerEvent.Sequence.endEvent
field is no longerpublic
, but now has anEndEvent
property. - Changed the other properties relating to End Events to not use
ref
returns because they now need to properly detect when their value is set (forOptionalWarning.LockedEvents
).
- Added
- Added
AnimancerComponent
Inspector warnings if there are multiple animation systems trying to control the same object:- Multiple
AnimancerComponent
s on the same object targeting the sameAnimator
. - A Legacy
Animation
component on the same object as the targetAnimator
.
- Multiple
- Added an
AnimancerComponent
Inspector warning when a state is playing atWeight == 0
withAnimancerPlayable.KeepPlayablesConnected
set tofalse
. - Added
AnimancerLayer.WeightlessThreshold
as a small leeway value forGetOrCreateWeightlessState
. - Added
PlayableAssetState.AppendDetails
to describe itsBindings
. - Added
ClipTransition.Length
. - Added
ClipTransitionSequence.AddEvent
for adding events relative to the entire sequence. #183 - Added
AnimancerEvent.Sequence.AddAllEvents
for turning Animation Events from anAnimationClip
into Animancer Events. #198 - Added
AnimancerTransitionAssetBase.UnShared.ClearCachedEvents
. - Added support for
NO_RUNTIME_PLAYER_PREFS
Conditional Compilation Symbol to remove all usage ofPlayerPrefs
from Runtime Builds because it is not allowed on some platforms. - Added assertions to ensure that
MixerState
andControllerState
parameters are notNaN
orInfinity
. - Added
AnimancerUtilities.GetUnsupportedMessage
andCreateUnsupportedArgumentException
. - Added
AnimancerTransitionAssetBase
as the base class ofAnimancerTransitionAsset<T>
. - Added assertions to Transition Assets to give more useful errors if you try to use them when their transition isn't assigned.
- Added an
Open Animancer Tools
button to theAnimationClip
Inspector. - Added overloads of
EndEventReceiver.GetFadeOutDuration
which take anAnimancerState
. - Added
AnimancerState.DelayedPause
. #207 - Added non-generic
IStateMachine
interface. - Added keyed
StateMachine<TKey, TState>.WithDefault
.
Changes
- Un-
sealed
lots of classes. - Replaced
ControllerState.KeepStateOnStop
withActionsOnStop
to give individual control over each layer.ActionOnStop.Continue
can be used for sync layers so it doesn't try to control them (because Unity gives a warning for that but doesn't give Animancer any way to detect which layers are synced at runtime).- Removed
ControllerState.NormalizedStartTime
since it overlaps with the newActionsOnStop
and only worked on Layer 0 anyway.
- Replaced the exception for reaching the maximum state depth in
AnimancerLayer.GetOrCreateWeightlessState
withOptionalWarning.MaxStateDepth
since it is only a recommendation anyway. - Changed the default
NormalizedStartTime
ofClipTransition
andPlayableAssetTransition
toNaN
instead of0
so they won't useFadeMode.FromStart
by default and will share the same default behaviour as playing anAnimationClip
. - Changed the default value of
SoloAnimation.ApplyInEditMode
tofalse
to avoid modifying scene objects unexpectedly. - Changed
AnimancerPlayable.StateDictionary.Create
andGetOrCreate
to not connect the states to layer 0. If you want to do that, you can useanimancerComponent.Layers[0].CreateState
instead. - Changed
AnimancerPlayable.StateDictionary.ReferenceKeysOnly
into anEqualityComparer
so you could potentially assign a custom comparer rather than only the two included in Animancer. - Removed the code that disables object selection in the Transition Preview Window.
- Cleaned up
PlayableAssetState.InitializeBindings
. - Refactored
AnimancerToolsWinow
:- Moved it into the
Animancer.Editor.Tools
namespace. - Moved the panels out of it so they are no longer nested classes.
- It now uses reflection to gather the tools rather than hard coding them as individual fields so new tools can be added without modifying the window.
- Moved it into the
- Removed the exception for adding a new layer beyond the
AnimancerPlayable.LayerList.Capacity
. It now just doubles the capacity like a regular list. - Removed the standard Animation Event names systems (
SimpleEventReceiver
andEndEventReceiver
).SimpleEventReceiver
was inefficient due to requiring anAnimationEvent
parameter (which allocates garbage every time an event is triggered) to backtrack and try to figure out which animation the event actually came from to avoid triggering the callback in response to an event from the wrong state.EndEventReceiver
was unreliable because it relied on registering your callback as an End Event but didn't actually prevent Animancer from checking and triggering that End Event like it normally would, meaning you might as well just use an End Event.- Those scripts were originally created before Animancer Events were implemented and have been removed because they don't facilitate an effective workflow for any common use case.
- If you still want to use those scripts, they're available on request (simply use any of the contact methods listed on the Help page).
ExitEvent
is still included because it serves a notably different purpose (though its use is generally not encouraged).
Fixes
- Fixed
AnimancerPlayable
to not give compile warnings in Unity 2022.1. #208 - Fixed
InvalidCastException
inControllerState.ValidateHasParameter
,AnimancerPlayableDrawer.DoNativeAnimatorControllerGUI
, andControllerTransition.Drawer.DoChildPropertyGUI
when using an Animator Controller loaded from an Asset Bundle. - Fixed potential
InvalidCastException
inSpriteEditor
. - Fixed
AnimancerPlayable.TryGetOutput
to actually work. - Fixed Animancer Events on looping animations to be triggered properly when calling
AnimancerComponent.Play
repeatedly. - Fixed potential
NullReferenceException
inAnimationGatherer
. - Fixed the
TransitionPreviewWindow
to not disable scripts withrunInEditMode
,ExecuteAlways
, orExecuteInEditMode
.- This prevents it from breaking
SpriteSkin
components from the 2D Animation package.
- This prevents it from breaking
- Fixed
TransitionPreviewWindow.OpenOrClose
to not give warnings about camera rotation in 2D Mode in Unity 2021.2. - Fixed incorrect Binding Type Mismatch error in
PlayableAssetState
. #171 - Fixed
PlayableAssetState
to properly bind anINotificationReceiver
to aSignalTrack
. - Fixed "PlayableGraph was not destroyed" warning in
AnimationClipEditor
if you exit Play Mode with anAnimationClip
asset showing in the Inspector. - Fixed
AnimancerState.EventDispatcher.GetLoopDelta
to work correctly when thenextTime
is exactly on theeventTime
. #205 - Fixed
AnimancerState.HasEvents
to not get a sequence from theObjectPool
if it has anEventDispatcher
without a sequence when accessing theAnimancerState.Events
. - Fixed
ControllerState.RawTime
to allow the time to be set while it is paused. #207 - Fixed
AnimationBindings
to not clear its cache every time the hierarchy is changed. - Fixed
EndEventReceiver.TryInvokeOnEndEvent
to not complain about a missing receiver if it found one that has no events. - Fixed possible
ArgumentException
inAnimancerEvent.Sequence.Insert
. - Fixed the "playing at 0 weight" Inspector warning to not appear when the state is fading.
- Fixed
SerializableEventSequenceDrawer
height to only take up one line when showing the "Multi-object editing message". - Fixed mixer transitions to not allow their Animations to be edited when multiple objects are selected with different values. Previously, one of the objects would immediately overwrite the others.
- Fixed
ClipTransitionSequence.IsLooping
to not cause infinite recursion when there is only one clip. - Fixed the base
UnShared.Asset
property setter to clear the cachedState
andEvents
. - Fixed "Identifier uniqueness violation" issues in the Modify Sprites and Rename Sprites tools by adding support for the 2D Sprite package.
- Fixed the fade duration to be calculated correctly for a layer if its state is already mid-fade.
- Fixed several incorrect values in
[DefaultValue]
attributes (0
instead of0f
).