Released 2020-12-04
Upgrade Guide
- See the Animancer v5.0 Upgrade Guide first if you're upgrading from a version older than that.
- The
Animancer.FSMsystem now uses a newStateChangesystem:- The following types no longer require a generic argument:
IState,StateBehaviour,DelegateState. IState.CanEnterStateandCanExitStateare now properties. The State Change Details section explains how to access the previous and next state which were previously passed in as parameters.
- The following types no longer require a generic argument:
Here is a summary of how to modify a state class to accomodate the new changes.
Old
class CharacterState : IState<CharacterState>
{
// Expression Bodied Method:
public virtual bool CanEnterState(CharacterState previousState) => true;
// Regular (Block Bodied) Method:
public virtual bool CanExitState(CharacterState nextState)
{
return true;
}
public virtual void OnEnterState() { }
public virtual void OnExitState() { }
}
New
class CharacterState : IState// Remove the generic argument from IState.
{
// Change the Can... methods to properties.
// Expression Bodied Property:
public virtual bool CanEnterState => true;
// Regular (Block Bodied) Property:
public virtual bool CanExitState
{
get
{
return true;
}
}
// No change to OnEnterState or OnExitState.
public virtual void OnEnterState() { }
public virtual void OnExitState() { }
}
The old previousState and nextState that were passed into CanEnterState and CanExitState are now accessible via static properties in StateChange<CharacterState> as well as several other options explained in the State Change Details section.
Major Features
- Added a search bar to the top of the documentation which uses Google Programmable Search.
Native Animator Controllers
Added proper support for Native Animator Controllers (ones assigned to the regular Controller field on the Animator component):
- Adding an
AnimancerComponentno longer clears that field or collapses theAnimatorInspector. - The
AnimancerComponentInspector no longer displays theAnimatorfields nested inside itself since they are now all usable andtheControllerfield doesn't need to be highlighted as a warning. - Replaced the
Basics/Simple Hybridexample withAnimator Controllers/Hybrid Basics. - Added Controller State Generator to Weaver which can procedurally generate a class that inherits from
ControllerStatewith properties for directly accessing the parameters of a specific Animator Controller asset. - Added Generate Transition context menu functions on everything inside Animator Controllers (States, Blend Trees, etc.) which will generate Transition Assets from them.
Animancer Tools
Added the Animancer Tools window which can be opened via Window/Animation/Animancer Tools and has 5 panels:
- Modify Sprites: allows you to modify the
rect,pivot,alignment, andbordersof multiplSprites at once. - Rename Sprites: allows you to rename multiple
Sprites at once. - Generate Sprite Animations: allows you to generate animations from
Sprites based ontheir names. - Remap Sprite Animation: allows you to change an animation to use different
Sprites. - Remap Animation Bindings: allows you to change the Hierarchy paths used by an animation. This is particularly useful for bone animations if you want to rename the bones in a model.
Improved State Machines
Improved the Finite State Machine system:
- Added a new system for accessing State Change Details as explained in the Upgrade Guide
- Added State Selectors for managing a prioritised list of potential states.
- Added
Game Managerexample as the first in the State Machines group which demonstrates theAnimancer.FSMwithoutStateBehaviours in comparison to an enum based system. It is currently the second longest of all 32 examples (longest is 3D Game Kit).
Flexible Mixer Transitions
Mixer Transitions can now use either AnimationClips or Transition Assets (any ITransition that inherits from UnityEngine.Object) for their children, meaning that you can now fully set up Nested Mixers using transitions instead of in code.
- Renamed
ManualMixerTransition.ClipstoStatesand changed it from anAnimationClip[]to anObject[]. - Added several
AnimancerUtilities.TryGet...methods that take anObjectand output a particular value from it as anAnimationClipor the corresponding value from anITransition.
Minor Features
- Animancer Events:
- The
AnimancerNodecontext menu now shows the details of all Animancer Events instead of only the End Events. - Added
AnimancerEvent.Sequence.RemoveCallback. #77 - Added a
startIndexparameter toAnimancerEvent.Sequence.IndexOfandIndexOfRequired(default value 0). - Added equality operators to
AnimancerEvent. - Added
AnimancerEvent.Sequence.Serializable.SetNormalizedEndTime. - Added
ITransitionDetailed.EventsandSerializedEvents. - Added context menu functions to the
TimeRulerfor all the functions that can be executed via keyboard controls.
- The
- Added
Stateas anabstractclass that implementsIStateusingvirtualmethods so you can inherit from it to avoid needing to specify all 4 members ofIStateyourself. - Added
Initialize 8 Directionsfunction to theThresholdsmenu forMixerTransition2D. - Added
ITransitionDetailed.AverageAngularSpeedandAverageVelocity. - Added
AnimancerPlayable.SkipFirstFadeto control whether playing an animation with the Base Layer at 0Weightshould snap theWeightto 1 (as it did previously) or allow the fade to play normally (so that it can fade from the Native Animator Controller). - Added
AnimancerEditorUtilities.IsNaNforVector2andVector3.
Changes
- Renamed
AnimancerLayer.Play(object)toTryPlayto match the name used inAnimancerPlayableandAnimancerComponent. - Renamed
AnimancerNode.EditorNametoDebugNameand made it available in Development Builds as well as in the Unity Editor. - Renamed
ControllerState.ParametertoParameterIDand cleaned up its usage:- It is now a
readonlystruct. - Added a constructor that takes both a
nameandhash(but doesn't verify them). Float1ControllerStatenow exposes itsParameterIDdirectly instead of having separate properties for the name and hash (same for the2and3variants).
- It is now a
- Changed
AnimancerState.Durationto properly account for the End Time. - Changed
AnimancerState.RemainingDurationto properly account for the End Time and negative speeds and not give different results for looping animations since End Events don't work any differently for them. - Changed
AnimancerState.IsPlayingto not bevirtualand addedOnSetIsPlayinginstead since only the setter should ever be overridden. - Changed
AnimancerUtilities.Wrap01andAnimancerUtilities.Wrapto not be extension methods since they aren't used that often. - State Machines:
- Changed
StateMachines to not allow the state to be set to null unless you callSetAllowNullStatesfirst. This assertion is only performed in the Unity Editor and Development Builds. - Removed
StateExtensions.CanEnterStatesince it is too similar to theIState.CanEnterStateproperty. - Removed the
DelegateStateconstructor since object initializer syntax is clearer anyway. - Removed the
InterruptManagement.Characterscript and modified itsCharacterStateto inherit fromCharacters.CharacterStatenow thatStateBehaviouris no longer generic. - Changed the
StateMachine<TState>.InputBuffer.StateMachineto a readonly field.
- Changed
- Animancer Events:
- Removed the Inspector toggle from event times which was previously used to remove them.
- Changed the Add Event button in the Inspector into an
Xto remove the selected event (while one is selected). - Changed
AnimancerEvent.Sequence.SetCallbackto triggerOptionalWarning.DuplicateEventif necessary. - Changed
AnimancerEvent.Sequencemethods that modify callbacks to throw anArgumentNullExceptionif the callback is null rather than just logging an assertion. - Moved
AnimancerEvent.Sequence.Serializable.DummyCallbackout toAnimancerEventand added aDummymethod so that it has a proper name instead of a compiler generated name for an anonymous method..
- Inverse Kinematics:
- Changed
AnimancerPlayable,AnimancerLayer, andMixerStateto store whatever IK flags you set (ApplyAnimatorIKandApplyFootIK) so that when a child is added it can get the same flags. - You can disable the static
AnimancerNode.ApplyParentAnimatorIKandApplyParentFootIKproperties to prevent children from receiving their parent's flags. - Added the IK flags to
AnimancerNode.AppendDescription. - Removed
IHasIKand merged it intoIPlayableWrapper. - Removed
AnimancerPlayable.DefaultApplyAnimatorIKandDefaultApplyFootIK.
- Changed
- Removed
AnimancerPlayable.LayerList.RespectSingleLayerWeightsince it is now handled byAnimancerPlayable.SkipFirstFade. - Removed
AnimancerEditorUtilities.GetIsInspectorExpandedandSetIsInspectorExpandedsince they are now unused. They were just wrappers aroundUnityEditorInternal.InternalEditorUtilitymethods anyway. - Removed
AnimancerUtilities.IfMultiComponentThenChangeType. - Removed the ability to
Ctrl + Shift + Clickon states in the Inspector to queue them to Cross Fade in a sequence (and the context menu function) since it was more complex to maintain than its usefulness warranted.
Improvements
- The Time bars displayed on states in the
AnimancerComponentInspector now scale their height proportional to theAnimancerNode.EffectiveWeight.- Added a Display Option in the context menu to disable that feature.
- Improved Timeline track binding support:
- Added
OptionalWarning.PlayableAssetAnimatorBindingin case aPlayableAssetStatetries to bind to the sameAnimatoras Animancer. - The
IsPlayingstate is now propogated onto all tracks. - Tracks which don't require an object to bind will now properly create their output and are shown in the Inspector as a simple label without an
Objectfield. - If a binding has the wrong type, it is now highlighted as a warning in the Inspector.
- Added
- Optimised
AnimancerEvent.Sequencemethods that search for a particular item. - Added
Removefunction to the event sub-menus of theAnimancerStateInspector context menu. - Improved the
AnimationGathererto be able to gather clips and transitions separately.
Fixes
- Implemented a workaround for the Serialized Array Initialization Bug for Transitions: if all the fields of a transition are at the default values of their type (i.e.
Fade DurationandSpeedat 0 rather than the 0.25 and 1 set by their field initializers) then assigning its main object (i.e. theAnimationClipfor aClipTransition) will initialize its values properly.- Removed the
Reset TransitionContext Menu Function since it was mainly just a manual workaround for that issue. Inspector Gadgets has Context Menu Functions toReset,Copy, andPasteany serialized field (and many others).
- Removed the
- Fixed
AnimancerLayer.Play(state, fadeDuration, fadeMode)to set theWeight = 1if it redirects toPlay(state)(usually due to havingfadeDuration <= 0).- Removed
AnimancerEditorUtilities.TopologicalSortsince it is no longer needed.
- Removed
- Fixed
AnimationBindings.GetBindingsto allow gathering multiple times per frame by default and only disable it for GUI calls. - Fixed the
TransitionPreviewWindowmodels list to automatically remove duplicates. - Fixed
TransitionPreviewWindowto not cause errors when it instantiates a copy of an object that has[RequireComponent]attributes on its components which create a circular reference (ArequiresBandBrequiresA). It doesn't seem to be possible to destroy such components so it now just disables all undesirable components instead of destroying them. - Fixed the
TransitionPreviewWindowto properly initialize the camera when the target has no bounds. - Fixed the keyed
StateMachineto properly register the default state provided in the constructor. - Fixed
AnimancerGUI.DoOptionalTimeToggleto properly indicate when the selected objects have different values.- Fixed
AnimancerState.EventRunnerto allow events to be assigned before theAnimancerNode.Rootis set. - Fixed
EventSequenceDrawerto avoid causing errors when multiple objects are selected with different values.
- Fixed
- Fixed
AnimancerUtilities.Wrap01andWrapto never return the maximum value (unlikeMathf.Repeat). - Animancer Events:
- Fixed
AnimancerState.EventRunnerto allow events to be assigned before theAnimancerNode.Rootis set. - Fixed
EventSequenceDrawerto avoid causing errors when multiple objects are selected with different values. - Fixed
AnimancerEvent.Sequence.Serializable.OnBeforeSerializeto not cause an exception if called when there is noEditor.EventSequenceDrawer.Context.Current.
- Fixed
- Fixed
UnityVersionCheckerto get properly removed when overriding Animancer Lite with Animancer Pro by moving it into theReadMe.csfile. - Fixed the
AnimancerStateInspector context menu to disable theInvokefunction for events using theAnimancerEvent.DummyCallback. - Fixed
TransitionPreviewWindow.GetCurrentStateto not throw an exception if the state doesn't exist. - Fixed the
AssemblyInfo.csfile to be properly included in Animancer Pro.