Animancer.Lite
Various extension methods and utilities.
[Animancer Extension] Loops the `value` so that 0 <= value < 1.
This is more efficient than using with a length of 1.
[Animancer Extension] Returns true as long as the `value` is not NaN or Infinity.
Newer versions of the .NET framework apparently have a float.IsFinite method.
If `obj` exists, this method returns .
Or if it is null, this method returns "null".
Or if it is an that has been destroyed, this method returns "Null (ObjectType)".
[Animancer Extension] Swaps array[a] with array[b].
[Animancer Extension]
Adds the specified type of , links it to the `animator`, and returns it.
[Animancer Extension]
Returns the on the same as the `animator` if
there is one. Otherwise this method adds a new one and returns it.
Returns true if the `node` is not null and .
Returns true if the `node` is not null and .
Checks if any in the `source` has an animation event with the specified
`functionName`.
Checks if the `clip` has an animation event with the specified `functionName`.
[Pro-Only]
Calculates all thresholds in the `mixer` using the of each
state on the X and Z axes.
Note that this method requires the Root Transform Position (XZ) -> Bake Into Pose toggle to be
disabled in the Import Settings of each in the mixer.
[Editor-Conditional] Marks the `target` as dirty.
[Editor-Conditional]
If there are multiple components which inherit from , the first one is changed to
the type of the second and any after the first are destroyed. This allows you to change the type without
losing the values of any serialized fields they share.
The `currentComponent` is used to determine which to examine and the base
component type .
protected void Reset()
{
AnimancerUtilities.IfMultiComponentThenChangeType(this);
}
[Editor-Conditional]
Plays the specified `clip` if called in Edit Mode and optionally pauses it immediately.
Before Unity 2018.3, playing animations in Edit Mode didn't work properly.
[Animancer Extension]
Adds the `clip` to the `clips` if it wasn't there already.
[Animancer Extension]
Calls for each of the `newClips`.
[Animancer Extension]
Calls for each of the `newClips`.
[Animancer Extension]
Calls for each clip in the `asset`.
Gathers all the animations in the `tracks`.
[Animancer Extension]
Calls for each clip gathered by
.
[Animancer Extension]
Calls for each clip in the `source`,
supporting both and .
[Animancer Extension]
Calls for each of the `sources`.
An which ignores overloaded equality operators so it is faster than
for types derived from .
Singleton instance.
Calls .
Calls .
An which uses to be even faster than
. Unfortunately this means it will not work for boxed value types (such as enums).
Singleton instance.
Calls .
Calls .
An object with a so it can be used in a .
The which stores the list index of this object.
Stores the index of an object in a to allow it to be efficiently removed.
Returns location of this object in the list (or -1 if it is not currently in a keyed list).
Indicates whether the specified object is currently in a keyed list.
A is its own .
A which can remove items without needing to search through the entire collection.
Does not allow nulls to be added.
To use an object in a Keyed List, it must either inherit from or implement
like so:
class MyClass : IKeyHolder
{
private readonly Key Key = new Key();
Key IKeyHolder.Key { get { return Key; } }
}
Note that the Key field can be made public if desired.
This class is nested inside so it can modify the private without
exposing that capability to anything else.
Creates a new using the default constructor.
Creates a new with the specified initial `capacity`.
The number of items currently in the list.
The number of items that this list can contain before resizing is required.
Gets or sets the item at the specified `index`.
Thrown by the setter if the `value` was already in a keyed list.
Adds the `item` to the end of this list.
Thrown if the `item` was already in a keyed list.
Adds the `item` to the end of this list if it wasn't already in one.
Removes the item at the specified `index`.
Removes the item at the specified `index` by swapping the last item in this list into its place.
This does not maintain the order of items, but is more efficient than because
it avoids the need to move every item after the target down one place.
Removes the `item` from this list.
Removes the `item` by swapping the last item in this list into its place.
This does not maintain the order of items, but is more efficient than because
it avoids the need to move every item after the target down one place.
Removes all items from this list.
Indicates whether the `item` is currently in this list.
Returns the index of the `item` in this list or -1 if it is not in this list.
Adds the `item` to this list at the specified `index`.
Copies all the items from this list into the `array`, starting at the specified `arrayIndex`.
Returns false.
Returns an enumerator that iterates through this list.
Returns an enumerator that iterates through this list.
Convenience methods for accessing .
Calls to get a spare item if there are any, or create a new one.
Calls to get a spare item if there are any, or create a new one.
Calls to add the `item` to the list of spares so it can be reused.
Calls to add the `item` to the list of spares so it can be reused.
Calls to get a spare if
there are any or create a new one.
Calls to clear the `list` and mark it as a spare
so it can be later returned by .
Calls to get a spare if
there are any or create a new one.
Calls to clear the `set` and mark it as a spare
so it can be later returned by .
A simple object pooling system.
The number of spare items currently in the pool.
If the is less than the specified value, this method increases it to that value by
creating new objects.
The of the internal list of spare items.
Returns a spare item if there are any, or creates a new one.
Adds the `item` to the list of spares so it can be reused.
Returns a description of the state of this pool.
[Pro-Only]
An which plays a .
You can control this state very similarly to an via its field.
The which this state plays.
The which this state plays.
The internal system which plays the .
If false, will reset all layers to their default state. Default False.
If you set this value to false after the constructor, you must assign the
or call yourself.
The of the default state on each layer, used to reset to
those states when is called.
Constructs a new to play the `controller`.
Creates and assigns the managed by this node.
The current state on layer 0, or the next state if it is currently in a transition.
The * of the
The current (on layer 0).
Indicates whether the current state on layer 0 will loop back to the start when it reaches the end.
Gathers the from the current states.
Calls the base and if is false it also
calls .
Resets all layers to their default state.
Thrown if is null.
Thrown if the size of is larger than the number of layers in the
.
Returns a string describing the type of this state and the name of the .
[]
Gathers all the animations in this state.
Destroys the .
A wrapper for the name and hash of an to allow easy access.
The name of the wrapped parameter. This will be null if the was assigned directly.
The name hash of the wrapped parameter.
Constructs a new with the specified and uses
to calculate the .
Constructs a new with the specified and leaves the
null.
Constructs a new with the specified and uses
to calculate the .
Constructs a new with the specified and leaves the
null.
Returns the .
[Editor-Conditional]
Throws if the `controller` doesn't have a parameter with the specified
and `type`.
Returns a string containing the and .
The number of parameters being wrapped by this state.
Returns the hash of a parameter being wrapped by this state.
Thrown if this state doesn't wrap any parameters.
[Editor-Only] Returns a for this state.
[Editor-Only] Draws the Inspector GUI for an .
Constructs a new to manage the Inspector GUI for the `state`.
Draws the details of the target state in the GUI.
Fills the list with the current parameter details.
The number of parameters being managed by the target state.
Returns the name of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Returns the type of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Returns the value of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Sets the value of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Base class for serializable s which can create a particular type of
when passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
Even though it has the , this class won't actually get serialized
by Unity because it's generic and abstract. Each child class still needs to include the attribute.
[]
The that will be used for the created state.
[]
If false, will reset all layers to their default state.
If you set this value to false after the constructor, you must assign the
or call yourself.
[]
The maximum amount of time the animation is expected to take (in seconds).
Indicates whether this transition can create a valid .
Returns the .
Adds all clips in the to the collection.
A serializable which can create a when
passed into .
This class can be implicitly cast to and from .
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
Constructs a new .
Constructs a new with the specified Animator Controller.
Constructs a new with the specified Animator Controller.
[Editor-Only] Draws the Inspector GUI for a or
.
Constructs a new without any parameters.
Constructs a new and sets the .
Draws the `property` GUI in relation to the `rootProperty` which was passed into
.
Draws a dropdown menu to select the name of a parameter in the `controller`.
[Pro-Only]
A which manages one float parameter.
See also: and .
The name of the parameter which will get and set.
This will be null if the was assigned directly.
The name hash of the parameter which will get and set.
Gets and sets a float parameter in the using the
as the id.
Constructs a new to play the `controller`.
The number of parameters being wrapped by this state.
Returns the hash of a parameter being wrapped by this state.
A serializable which can create a
when passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
[]
The that will be used for the created state.
Constructs a new .
Constructs a new with the specified Animator Controller and parameter.
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
[Editor-Only] Draws the Inspector GUI for a .
Constructs a new and sets the
.
[Pro-Only]
A which manages two float parameters.
See also: and .
The name of the parameter which will get and set.
This will be null if the was assigned directly.
The name hash of the parameter which will get and set.
Gets and sets a float parameter in the using the
as the id.
The name of the parameter which will get and set.
This will be null if the was assigned directly.
The name hash of the parameter which will get and set.
Gets and sets a float parameter in the using the
as the id.
Gets and sets and .
Constructs a new to play the `controller`.
The number of parameters being wrapped by this state.
Returns the hash of a parameter being wrapped by this state.
A serializable which can create a
when passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
[]
The that will be used for the created state.
[]
The that will be used for the created state.
Constructs a new .
Constructs a new with the specified Animator Controller and parameters.
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
[Editor-Only] Draws the Inspector GUI for a .
Constructs a new and sets the
.
[Pro-Only]
A which manages three float parameters.
See also: and .
The name of the parameter which will get and set.
This will be null if the was assigned directly.
The name hash of the parameter which will get and set.
Gets and sets a float parameter in the using the
as the id.
The name of the parameter which will get and set.
This will be null if the was assigned directly.
The name hash of the parameter which will get and set.
Gets and sets a float parameter in the using the
as the id.
The name of the parameter which will get and set.
This will be null if the was assigned directly.
The name hash of the parameter which will get and set.
Gets and sets a float parameter in the using the
as the id.
Gets and sets , , and .
Constructs a new to play the `controller`.
The number of parameters being wrapped by this state.
Returns the hash of a parameter being wrapped by this state.
A serializable which can create a
when passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
[]
The that will be used for the created state.
[]
The that will be used for the created state.
[]
The that will be used for the created state.
Constructs a new .
Constructs a new with the specified Animator Controller and parameters.
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
[Editor-Only] Draws the Inspector GUI for a .
Constructs a new and sets the
.
A delegate paired with a to determine when to invoke it.
The at which to invoke the .
The delegate to invoke when the passes.
The largest possible float value less than 1.
Constructs a new .
Returns "AnimancerEvent(normalizedTime, callbackTarget.CallbackMethod)".
Appends the details of this event to the `text`.
The currently triggering an event using .
The currently being triggered by .
Sets the static and then invokes the .
This method catches and logs any exception thrown by the .
Thrown if the is null.
Returns either the `minDuration` or the of the
state (whichever is higher).
A variable-size list of s which keeps itself sorted by
.
Animancer Lite does not allow the use of events in a runtime build, except for .
A zero length array of s which is used by all lists before any elements are
added to them (unless their is set manually).
The initial that will be used if another value is not specified.
An which denotes the end of the animation. Its values can be accessed via
and .
By default, the will be so that it can choose the
correct value based on the current play direction: forwards ends at 1 and backwards ends at 0.
Animancer Lite does not allow the to be changed in a runtime build.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.Events.OnEnd = OnAnimationEnd;
state.Events.NormalizedEndTime = 0.75f;
// Or set the time and callback at the same time:
state.Events.endEvent = new AnimancerEvent(0.75f, OnAnimationEnd);
}
void OnAnimationEnd()
{
Debug.Log("Animation ended");
}
See the documentation for more information about
End Events.
The internal array in which the events are stored (excluding the ).
[Pro-Only] The number of events in this sequence (excluding the ).
[Pro-Only]
The number of times the contents of this sequence have been modified. This applies to general events,
but not the .
Creates a new which starts at 0 .
Adding anything to the list will set the =
and then double it whenever the would exceed the .
[Pro-Only]
Creates a new which starts with the specified . It will be
initially empty, but will have room for the given number of elements before any reallocations are
required.
Creates a new , copying the contents of `copyFrom` into it.
[Pro-Only]
Creates a new , copying and sorting the contents of the `collection` into it.
The and will be equal to the
.
[Pro-Only]
Creates a new , copying and sorting the contents of the `enumerable` into it.
Indicates whether the list has any events in it or the event's
is not at the default value (1).
[Pro-Only]
The size of the internal array used to hold events.
When set, the array is reallocated to the given size.
By default, the starts at 0 and increases to the
when the first event is added.
[Pro-Only] Gets the event at the specified `index`.
[Assert]
Throws an if the of any events
is less than 0 or greater than or equal to 1.
This does not include the since it works differently to other events.
[Assert]
Calls if `isLooping` is true.
Returns a string containing the details of all events in this sequence.
[Pro-Only] Returns an for this sequence.
[Pro-Only]
An iterator that can cycle through every event in a except for the
.
The target .
The event this iterator is currently pointing to.
The event this iterator is currently pointing to.
Creates a new .
Moves to the next event in the and returns true if there is one.
Thrown if the has changed since this iterator was created.
Returns this iterator to the start of the .
Thrown if the has changed since this iterator was created.
[Pro-Only]
Adds the given event to this list. The is increased by one and if required, the
is doubled to fit the new event.
This methods returns the index at which the event is added, which is determined by its
in order to keep the list sorted in ascending order. If there are already
any events with the same , the new event is added immediately after them.
[Pro-Only]
Adds the given event to this list. The is increased by one and if required, the
is doubled to fit the new event.
This methods returns the index at which the event is added, which is determined by its
in order to keep the list sorted in ascending order. If there are already
any events with the same , the new event is added immediately after them.
[Pro-Only]
Adds the given event to this list. The is increased by one and if required, the
is doubled to fit the new event.
This methods returns the index at which the event is added, which is determined by its
in order to keep the list sorted in ascending order. If there are already
any events with the same , the new event is added immediately after them.
[Pro-Only]
Adds the given event to this list. The is increased by one and if required, the
is doubled to fit the new event.
This methods returns the index at which the event is added, which is determined by its
in order to keep the list sorted in ascending order. If there are already
any events with the same , the new event is added immediately after them.
[Pro-Only]
Adds every event in the `enumerable` to this list. The is increased by one and if
required, the is doubled to fit the new event.
This methods returns the index at which the event is added, which is determined by its
in order to keep the list sorted in ascending order. If there are already
any events with the same , the new event is added immediately after them.
[Pro-Only]
Replaces the of the event at the specified `index`.
[Pro-Only]
Determines the index where a new event with the specified `normalizedTime` should be added in order to
keep this list sorted, increases the by one, doubles the if
required, moves any existing events to open up the chosen index, and returns that index.
This overload starts searching for the desired index from the end of the list, using the assumption
that elements will usually be added in order.
[Pro-Only]
Determines the index where a new event with the specified `normalizedTime` should be added in order to
keep this list sorted, increases the by one, doubles the if
required, moves any existing events to open up the chosen index, and returns that index.
This overload starts searching for the desired index from the `hint`.
[Pro-Only]
Increases the by one, doubles the if required, and moves any
existing events to open up the `index`.
[Pro-Only]
Removes the event at the specified `index` from this list by decrementing the and
copying all events after the removed one down one place.
[Pro-Only]
Removes the `animancerEvent` from this list by decrementing the and copying all
events after the removed one down one place. Returns true if the event was found and removed.
[Pro-Only]
Removes all events except the .
Removes all events, including the .
Shorthand for the endEvent.callback. This callback is triggered when the animation passes the
(not when the state is interrupted or exited for whatever reason).
Unlike regular events, this callback will be triggered every frame while it is past the end so if you
want to ensure that your callback only occurs once, you will need to clear it as part of that callback.
This callback is automatically cleared by ,
, and .
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.Events.OnEnd = OnAnimationEnd;
state.Events.NormalizedEndTime = 0.75f;
// Or set the time and callback at the same time:
state.Events.endEvent = new AnimancerEvent(0.75f, OnAnimationEnd);
}
void OnAnimationEnd()
{
Debug.Log("Animation ended");
}
See the documentation for more information about
End Events.
[Pro-Only]
Shorthand for endEvent.normalizedTime.
By default, this value will be so that it can choose the correct value based on
the current play direction: forwards ends at 1 and backwards ends at 0.
Animancer Lite does not allow this value to be changed in a runtime build.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.Events.OnEnd = OnAnimationEnd;
state.Events.NormalizedEndTime = 0.75f;
// Or set the time and callback at the same time:
state.Events.endEvent = new AnimancerEvent(0.75f, OnAnimationEnd);
}
void OnAnimationEnd()
{
Debug.Log("Animation ended");
}
See the documentation for more information about
End Events.
The default for an animation to start at when playing
forwards is 0 (the start of the animation) and when playing backwards is 1 (the end of the animation).
`speed` 0 or will also return 0.
This method has nothing to do with events, so it is only here because of
.
The default for an when playing forwards is 1 (the
end of the animation) and when playing backwards is 0 (the start of the animation).
`speed` 0 or will also return 1.
Copies all the events from the `source` to replace the previous contents of this list.
[]
Copies all the events from this list into the `array`, starting at the `index`.
An that can be serialized and uses
s to define the s.
If you have Animancer Pro you can replace s with
UltEvents using the following procedure:
- Select the Assets/Plugins/Animancer/Animancer.asmdef and add a Reference to the
UltEvents Assembly Definition.
- Go into the Player Settings of your project and add ANIMANCER_ULT_EVENTS as a Scripting
Define Symbol. Or you can simply edit this script to change the event type (it is located at
Assets/Plugins/Animancer/Internal/Core/AnimancerEvent.Sequence.Serializable.cs by default.
The serialized s.
The name of the array field which stores the s.
The serialized s.
This array only needs to be large enough to hold the last event that actually contains any calls.
Any empty or missing elements will simply use the at runtime.
The name of the array field which stores the serialized s.
The runtime compiled from this .
Each call after the first will return the same value.
Unlike , this method will create an empty
instead of returning null.
Returns the runtime compiled from this
. Each call after the first will return the same value.
This method returns null if the sequence would be empty anyway and is used by the implicit
conversion from to .
Calls .
A delegate that does nothing which is used whenever the is not
defined for a particular event or it is empty.
If the `callback` has any persistent calls, this method returns a delegate to call its
method. Otherwise it returns the
.
Determines if the `callback` contains any method calls that will be serialized (otherwise the
can be used instead of creating a new delegate to invoke the empty
`callback`).
Determines if the `callback` contains any method calls that will be serialized (otherwise the
can be used instead of creating a new delegate to invoke the empty
`callback`).
This method casts the `callback` to so the caller does not need
to know what type is actually being used.
Returns the of the .
If the value is not set, the value is determined by .
Gets the internal details of the specified `serializable`.
[Editor-Only] Does nothing.
[Editor-Only] Ensures that the events are sorted by time (excluding the end event).
[Editor-Only] [Internal]
A serializable container which holds a in a field named "_Callback".
needs to be in a file with the same name as it (otherwise it can't
draw the callback properly) and this class needs to be in the same file as
to use the alias.
[Editor-Only] Various utilities used throughout Animancer.
Tries to find a component on the `gameObject` or its parents or children (in that
order).
Assets cannot reference scene objects.
Wraps .
Wraps .
Calls on all `objects`.
Tries to find a method with the specified name on the `target` object and invoke it.
Tries to find a method with the specified name on the `target` object and invoke it.
Registers a delegate that can construct a description of an issue at a later time so that it doesn't waste
the user's time on unimportant issues.
Calls with an issue indicating that a particular type was not
found by reflection.
Calls with an issue indicating that a particular member was not
found by reflection.
Appends all issues given to to the `text`.
Gets the value of the `parameter` in the `animator`.
Gets the value of the `parameter` in the `playable`.
Sets the value of the `parameter` in the `animator`.
Sets the value of the `parameter` in the `playable`.
Waits one frame to call the `method` as long as Unity is currently in Edit Mode.
Adds a menu function which is disabled if `isEnabled` is false.
Adds a menu function which passes the result of into `startFade`.
Returns the duration of the `node`s current fade (if any), otherwise returns the `defaultDuration`.
Adds a menu function to open a web page. If the `linkSuffix` starts with a '/' then it will be relative to
the .
Toggles the flag between true and false.
Sets the flag.
Swaps the flag between true and false.
Calls .
[Editor-Only]
An that is not actually a .
Creates a new .
[] Returns true.
[] Returns the 's .
[] The target .
[] The target .
[] Returns true.
[] Returns false.
[] Does nothing.
[] Returns the `clip`.
[] Returns null.
[] Returns null.
Attempts to determine the of the specified `clip`.
Attempts to determine the of the specified `animator`.
Sorts an array according to an array of dependants.
If ItemA depends on ItemB, ItemA will be put later in the returned list.
The collection to sort. If any element depends on something that isn't present, it will be added automatically.
A delegate that can return the dependancies of any given element.
The equality comparer to use. Null will use the default comparer.
If false, an will be thrown when a cyclic dependancy is encountered
Sorts an array according to an array of dependants.
If ItemA depends on ItemB, ItemA will be put later in the returned list.
The list to sort. If any element depends on something that isn't present, it will be added automatically.
The index at which to start sorting. Everything before this index is kept in the same order as the input list.
A delegate that can return the dependancies of any given element.
The equality comparer to use. Null will use the default comparer.
If false, an will be thrown when a cyclic dependancy is encountered
Sorts an array according to an array of dependants.
If ItemA depends on ItemB, ItemA will be put later in the returned list.
This method assigns a new list and releases the old one to the CollectionPool.
The list to sort. If any element depends on something that isn't present, it will be added automatically.
The index at which to start sorting. Everything before this index is kept in the same order as the input list.
A delegate that can return the dependancies of any given element.
The equality comparer to use. Null will use the default comparer.
If false, an will be thrown when a cyclic dependancy is encountered
Takes a `gameObject` and returns the root of the character it is part of.
This method first searches all parents for an . If it finds one, it returns the
.
Otherwise, if the object is part of a prefab then it returns the root of that prefab instance.
Otherwise, it counts the number of s in the children of the `gameObject` then does
the same for each parent. If it finds a parent with a different number of child s, it
assumes that object is the parent of multiple characters and returns the previous parent as the root.
Simple Hierarchy
- Character - Rigidbody, etc.
- Model - Animator, AnimancerComponent
- States - Various components which reference the AnimationClips they will play
Passing the Model into this method will return the Character because it has the same
number of components in its children.
Shared Hierarchy
- Characters - Empty object used to group all characters
- Character - Rigidbody, etc.
- Model - Animator, AnimancerComponent
- States - Various components which reference the AnimationClips they will play
- Another Character
- Model
- States
- Model has one and no more in its children.
- And Character has one in its children (the same one).
- But Characters has two s in its children (one on each character).
So it picks the Character as the root.
Complex Hierarchy
- Character - Rigidbody, etc.
- Model - Animator, AnimancerComponent
- States - Various components which reference the AnimationClips they will play
- Another Model - Animator (maybe the character is holding a gun which has a reload animation)
In this case, the automatic system would see that the Character already has more child
s than the selected Model so it would only return the Model itself.
This can be fixed by making any of the scripts on the Character implement
to tell the system which object you want it to use as the root.
Calls if the specified `obj` is a or
.
[Editor-Only] Various GUI utilities used throughout Animancer.
The highlight color used for fields showing a warning.
The highlight color used for fields showing an error.
set to false.
Wrapper around .
Wrapper around .
The number of pixels of indentation for each increment.
The width of a standard with no label.
The color of the standard label text.
A more compact with a fixed size as a tiny box.
Indicates where should add the .
Uses to get a occupying a single
standard line with the added according to the specified `spacing`.
If the is positive, this method moves the by that amount and
adds the .
Subtracts the `width` from the left side of the `area` and returns a new occupying the
removed section.
Subtracts the `width` from the right side of the `area` and returns a new occupying the
removed section.
Divides the given `area` such that the fields associated with both labels will have equal space
remaining after the labels themselves.
Calls and returns the max width.
Calls and returns the max width.
This method uses the .
Creates a for calculating the GUI width occupied by text using the
specified `style`.
Calls using and returns the max
width. The result is cached for efficient reuse.
This method uses the .
Begins a vertical layout group using the given style and decreases the
to compensate for the indentation.
Ends a layout group started by and restores the
.
Used by .
Returns a with the specified parameters. The same instance is returned by
every subsequent call.
Returns a with the and
. The same instance is returned by every subsequent call.
Draws a label showing the `weight` aligned to the right side of the `area` and reduces its
to remove that label from its area.
The from before .
Stores the and changes it to the exact width of the `label`.
Reverts to its previous value.
Returns the `text` without any spaces if is false.
Otherwise simply returns the `text` without any changes.
Returns true and uses the current event if it is inside the specified
`area`.
Returns true and uses the current event if it is inside the last GUI Layout
that was drawn.
Invokes `onDrop` if the is a drag and drop event inside the `dropArea`.
Updates the of calls `onDrop` for each of the `objects`.
Uses to deal with drag and drop operations involving
s of s.
Deselects any selected IMGUI control.
Draw a with an alternate cached string when it
is not selected (for example, "1" might become "1s" to indicate "seconds").
Draw a with an alternate cached string when it
is not selected (for example, "1" might become "1s" to indicate "seconds").
Draw a which sets the value to
when disabled followed by two float fields to display the as
both normalized time and seconds.
Draw a which sets the value to
when disabled followed by two float fields to display the `time` both normalized and in seconds.
[Editor-Only]
Allows animations to be procedurally gathered throughout the hierarchy without needing explicit references.
This class is [Editor-Only] because it uses reflection and is not particularly efficient, but it does not
actually use any Editor Only functionality so it could be made usable at runtime by simply removing the
#if UNITY_EDITOR at the top of the file and #endif at the bottom.
Clears all cached animations.
Fills the `clips` with any s referenced by components in the same hierarchy as
the `gameObject`. See for details.
Fills the `clips` with any s referenced by components in the same hierarchy as
the `gameObject`. See for details.
Gathers all animations from the `source`s fields.
Types mapped to a delegate that can quickly gather their clips.
Uses reflection to gather s from fields on the `source` object.
Creates a delegate to gather s from all relevant fields in a given `type`.
[Editor-Only]
The type of object an can animate.
Unable to determine a type.
A Humanoid rig.
A Generic rig.
An animation that modifies a .
This is technically a animation.
[Editor-Only]
A simple wrapper around to get and set a bool.
If you are interested in a more comprehensive pref wrapper that supports more types, you should check out
Inspector Gadgets.
The prefix which is automatically added before the .
The identifier with which this pref will be saved.
The label to use when adding a function to toggle this pref to a menu.
The starting value to use for this pref if none was previously saved.
The current value of this pref.
Returns the current value of the `pref`.
Constructs a new .
Constructs a new .
Adds a menu function to toggle the of this pref.
A simple system for converting objects and storing the results so they can be reused to minimise the need for
garbage collection, particularly for string construction.
Creates a new which uses the specified delegate to convert values.
If a value has already been cached for the specified `key`, return it. Otherwise create a new one using
the delegate provided in the constructor and cache it.
This method also periodically removes values that have not been used recently.
[Editor-Only] A cached width calculation for GUI elements.
Returns the width the `text` would take up if drawn with the `style`.
Called when is called with different parameters.
[Editor-Only]
A cached width calculation for GUI elements which accounts for boldness in prefab overrides.
Called when is called with different parameters.
Returns the width the `text` would take up if drawn with the `style`.
Returns the width the `text` would take up if drawn with the `style`.
[Internal]
A custom Inspector for an which sorts and exposes some of its internal values.
The states in the target layer which have non-zero .
The states in the target layer which have zero .
The used for the area encompassing this drawer. .
Initialises an editor in the list for each layer in the `animancer`.
The `count` indicates the number of elements actually being used. Spare elements are kept in the list in
case they need to be used again later.
Sets the target `layer` and sorts its states and their keys into the active/inactive lists.
Sorts any entries that use another state as their key to come right after that state.
See .
Draws the layer's name and weight.
The number of pixels of indentation required to fit the foldout arrow.
Draws a foldout arrow to expand/collapse the state details.
Draws the details of the target state in the GUI.
Draws controls for and .
Draws all `states` in the given list.
Cached Inspectors that have already been created for states.
Draws the Inspector for the given `state`.
Draws all child states of the `state`.
Draws the details and controls for the target in the Inspector.
If s or s are dropped inside the `dropArea`,
this method creates a new state in the `target` for each animation.
Adds functions relevant to the .
[Editor-Only] Draws the Inspector GUI for an .
Draws the details and controls for the target node in the Inspector.
[Editor-Only] Draws the Inspector GUI for an .
The node being managed.
If true, the details of the will be expanded in the Inspector.
The used for the area encompassing this drawer.
Draws the details and controls for the target in the Inspector.
Draws the name and other details of the in the GUI.
Draws a field for the if it has one, otherwise just a simple text
label.
Draws a foldout arrow to expand/collapse the node details.
Draws the details of the in the GUI.
Draws controls for , , and
.
Draws controls for and .
The menu label prefix used for details about the .
Checks if the current event is a context menu click within the `clickArea` and opens a context menu with various
functions for the .
Adds functions relevant to the .
[Editor-Only] Draws the Inspector GUI for an .
Only get during .
A lazy list of information about the layers currently being displayed.
The number of elements in that are currently being used.
Draws the GUI of the if there is only one target.
Draws the GUI of the .
[Editor-Only] Draws the Inspector GUI for an .
Constructs a new to manage the Inspector GUI for the `target`.
The used for the area encompassing this drawer. Null.
Draws the state's main label: an field if it has a
, otherwise just a simple text label.
Also shows a bar to indicate its progress.
Handles Ctrl + Click on the label to CrossFade the animation.
If Shift is also held, the effect will be queued until after the previous animation finishes.
Draws a foldout arrow to expand/collapse the state details.
Manages the playing of animations in sequence.
Clear out any playables that have been destroyed.
Gets the current .
If the state is looping, the value is modulo by the .
Draws the details of the target state in the GUI.
Draws a slider for controlling the current .
Adds functions relevant to the .
Adds the details of this state to the menu.
[Editor-Only]
A custom Inspector for s.
casted to .
The serialized backing field for the target's reference.
The drawer for the .
Initialises this .
Copies the into the array.
Cleans up this .
Called by the Unity editor to draw the custom Inspector GUI elements.
If we have only one object selected and are in Play Mode, we need to constantly repaint to keep the
Inspector up to date with the latest details.
Draws the rest of the Inspector fields after the Animator field.
[Editor-Only]
Draws any custom GUI for the `property`.
The return value indicates whether the GUI should replace the regular call to
or
not. True = GUI was drawn, so don't draw the regular GUI. False = Draw the regular GUI.
An object that holds a serialized callback (a by default) so that empty ones can be
drawn in the GUI without allocating array space for them until they actually contain something.
[Editor-Only] Draws the Inspector GUI for .
Details of an .
The main property representing the field.
The property representing the field.
The cached of .
Shorthand for on .
The property representing the field.
The cached of .
Shorthand for on .
The index of the currently selected event.
The singleton instance.
Returns a representing the `property`.
Note that the same instance is returned every time.
[]
Reduces the array size to remove any empty elements.
Shorthand for .
Can't cache because the doesn't work properly.
Calculates the number of vertical pixels the `property` will occupy when it is drawn.
Draws the GUI for the `property`.
Draws a button to add a new event.
Draws the GUI fields for the event at the specified `index`.
Draws the time field for the event at the specified `index`.
Removes the event at the specified `index`.
[Editor-Only]
A custom Inspector for drawing the nested inside its own Inspector.
The objects being edited.
The property that serializes the .
The animator referenced by each target.
Indicates whether all are on the same as the target that
is referencing them.
A encapsulating the .
A of the .
A of the .
A of the .
A of the .
A of the .
Creates a new to wrap the `animatorProperty`.
Cleans up this editor.
Ensures that the and properties for the have been
initialised.
Gathers the from the .
Draws the animator reference field followed by its fields that are relevant to Animancer.
Draws the field with a warning if a controller is
assigned.
Draws the field with any appropriate warnings.
Draws the field.
[Editor-Only] Draws the Inspector GUI for an .
The number of parameters being managed by the target state.
Returns the name of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Returns the type of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Returns the value of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Sets the value of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Constructs a new to manage the Inspector GUI for the `state`.
Draws the details of the target state in the GUI.
[Editor-Only] Draws a GUI box denoting a period of time.
Converts a number of seconds to a horizontal pixel position along the ruler.
Converts a horizontal pixel position along the ruler to a number of seconds.
Converts a number of seconds to a normalized time value.
Converts a normalized time value to a number of seconds.
Sets the `area` in which the ruler will be drawn and draws a there.
Must be followed by a call to .
Uses any unused events in the area and ends the area started by
.
Draws the ruler GUI and handles input events for the specified `context`.
Calculates the end time of the fade out.
Draws a polygon describing the start, end, and fade details.
Draws the details of the .
Draws ticks and labels for important times throughout the area.
[Editor-Only] Draws the Inspector GUI for a .
The visual state of a drawer.
The current state of this drawer.
If set, the field with this name will be drawn with the foldout arrow instead of in its default place.
"." + (to avoid creating garbage repeatedly).
Constructs a new .
Constructs a new and sets the
.
Returns the property specified by the .
Calculates the number of vertical pixels the `property` will occupy when it is drawn.
Draws the root `property` GUI and calls for each of its children.
If the is , this method determines how it should start
based on the number of properties in the `serializedObject`. If the only serialized field is an
then it should start expanded.
Draws the `property` GUI in relation to the `rootProperty` which was passed into .
The name of the backing field of .
If the `property` is a "Start Time" field, this method draws it as well as the "End Time" below it and
returns true.
The current .
Details of an .
The main property representing the field.
The actual transition object rerieved from the .
The cached value of .
Returns a disposable representing the specified parameters.
Note that the same instance is returned every time and it can be accessed via .
Clears the .
The possible states for a function in a .
Displayed normally.
Has a check mark next to it to show that it is selected.
Greyed out and unusable.
[Editor-Only] Various serialization utilities.
[Editor-Only] Various serialization utilities.
[Editor-Only] Various serialization utilities.
The text used in a to denote array elements.
The text used in a to denote array elements.
Returns a user friendly version of the .
Gets the value of the specified .
Gets the value of the .
Gets the value of the .
Gets the value of the .
Gets the value of the for each of its target objects.
Sets the value of the specified .
Sets the value of the .
Indicates whether both properties refer to the same underlying field.
Executes the `action` once with a new for each of the
. Or if there is only one target, it uses the `property`.
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
Adds a menu item to execute the specified `function` for each of the `property`s target objects.
Calls the specified `method` for each of the underlying values of the `property` (in case it represents
multiple selected objects) and records an undo step for any modifications made.
Records the state of the specified `property` so it can be undone.
Updates the specified `property` and marks its target objects as dirty so any changes to a prefab will be saved.
Returns the that represents fields of the specified `type`.
Returns an that can be used to access the details of the specified `property`.
Returns an for a with the specified `propertyPath`
on the specified `type` of object.
Returns a field with the specified `name` in the `declaringType` or any of its base types.
[Editor-Only]
A wrapper for accessing the underlying values and fields of a .
The accessor for the field which this accessor is nested inside.
The field wrapped by this accessor.
The type of the wrapped .
[Internal] Creates a new .
Creates a new .
Gets the value of the from the (if there is one), then uses it to get and return
the value of the .
Gets the value of the from the (if there is one), then uses it to get and return
the value of the .
Gets the value of the from the (if there is one), then uses it to get and return
the value of the .
Gets the value of the from the (if there is one), then uses it to set the value
of the .
Gets the value of the from the (if there is one), then uses it to set the value
of the .
Gets the value of the from the (if there is one), then uses it to set the value
of the .
Returns a description of this accessor's path.
Returns a this accessor's .
[Editor-Only]
An for a particular element in an array.
The index of the array element this accessor targets.
[Internal] Creates a new .
Returns the type of elements in the array.
Gets the value of the from the (if there is one), then uses it to
get and return the value of the .
Gets the value of the from the (if there is one), then uses it to
set the value of the .
Returns a description of this accessor's path.
Returns a this accessor's .
[Editor-Only]
Directly serializing an reference doesn't always work (such as with scene
objects when entering Play Mode), so this class also serialized their instance ID and uses that if the direct
reference fails.
The referenced .
The .
Constructs a new which wraps the specified
.
Constructs a new which wraps the specified
.
Returns the target .
Creates a new array of s representing the `objects`.
Creates a new array of s containing the target of each
of the `references`.
Indicates whether both arrays refer to the same set of objects.
Returns a string describing this object.
Returns true if the `reference` and are not null.
[Editor-Only]
A serializable reference to a .
[] The .
[] The .
[] The .
[] The .
Indicates whether the has been accessed.
[] The referenced .
Constructs a new which wraps the specified `property`.
Constructs a new which wraps the specified `property`.
Returns the target .
Returns true if the specified property and objects match the targets of this reference.
Returns true if there is at least one target and none of them are null.
Calls if the has been initialised.
Calls if the has been initialised.
Calls if the has been initialised.
Gets the height needed to draw the target property.
Draws the target object within the specified `area`.
Draws the target property within the specified `area`.
Returns true if the `reference` and are not null.
[Editor-Only]
Stores data which needs to survive assembly reloading (such as from script compilation), but can be discarded
when the Unity Editor is closed.
Finds an existing instance of this class or creates a new one.
[Editor-Only] [Pro-Only]
An which allows the user to preview animation transitions separately from the rest
of the scene in Edit Mode or Play Mode.
The icon image used by this window.
Focusses the or creates one if none exists.
Sets the of the current transition if the property being
previewed matches the .
Returns the of the current transition if the property being previewed matches
the . Otherwise returns null.
Indicates whether the current is being previewed
at the moment.
Indicates whether the `property` is able to be previewed by this system.
Destroys all unnecessary components on the preview instance while accounting for any
attributes.
The animator referenced by each target.
A encapsulating the .
The property.
Draws the target's serialized fields.
Draws a toggle inverted from the field.
Draws the target's runtime details.
A layer on which animations can play with their states managed independantly of other layers while blending the
output with those layers.
This class can be used as a custom yield instruction to wait until all animations finish playing.
[Internal] Constructs a new .
Creates and assigns the managed by this node.
A layer is its own root.
The receives the output of the .
Indicates whether child playables should stay connected to this mixer at all times.
All of the animation states connected to this layer.
The state of the animation currently being played.
Specifically, this is the state that was most recently started using any of the Play or CrossFade methods
on this layer. States controlled individually via methods in the itself will
not register in this property.
Each time this property changes, the is incremented.
The number of times the has changed. By storing this value and later comparing
the stored value to the current value, you can determine whether the state has been changed since then,
even it has changed back to the same state.
[Pro-Only]
Determines whether this layer is set to additive blending. Otherwise it will override any earlier layers.
[Pro-Only]
Sets an to determine which bones this layer will affect.
[Editor-Only]
The that determines which bones this layer will affect.
The average velocity of the root motion of all currently playing animations, taking their current
into account.
The number of states using this layer as their .
Returns the state connected to the specified `index` as a child of this layer.
This method is identical to .
Returns the state connected to the specified `index` as a child of this layer.
This indexer is identical to .
Adds a new port and uses to connect the `state` to it.
Connects the `state` to this layer at its .
Disconnects the `state` from this layer at its .
Returns an enumerator that will iterate through all states connected directly to this layer (not inside
s).
Creates and returns a new to play the `clip`.
This method uses to determine the .
Creates and returns a new to play the `clip` and registers it with the `key`.
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls and returns the state which registered with that key or
creates one if it doesn't exist.
If the state already exists but has the wrong , the `allowSetClip`
parameter determines what will happen. False causes it to throw an while
true allows it to change the . Note that the change is somewhat costly to
performance to use with caution.
Returns the state registered with the if there is one. Otherwise
this method uses to create a new one and registers it with
that key before returning it.
Returns the state which registered with the `key` or creates one if it doesn't exist.
If the state already exists but has the wrong , the `allowSetClip`
parameter determines what will happen. False causes it to throw an while
true allows it to change the . Note that the change is somewhat costly to
performance to use with caution.
Thrown if the `key` is null.
See also: .
Destroys all states connected to this layer. This operation cannot be undone.
Called by (when this layer starts fading, not when one of its states
starts fading). Clears the of all states.
Stops all other animations, plays the `clip`, and returns its state.
The animation will continue playing from its current .
To restart it from the beginning you can use ...Play(clip).Time = 0;.
Stops all other animations, plays the `state`, and returns it.
The animation will continue playing from its current .
If you wish to force it back to the start, you can simply set the `state`s time to 0.
Creates a state for the `transition` if it didn't already exist, then calls
or
depending on the .
Stops all other animations, plays the animation registered with the `key`, and returns that
state. If no state is registered with the `key`, this method does nothing and returns null.
The animation will continue playing from its current .
If you wish to force it back to the start, you can simply set the returned state's time to 0.
on the returned state.
Starts fading in the `clip` over the course of the `fadeDuration` while fading out all others in the same
layer. Returns its state.
If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
method will allow it to complete the existing fade rather than starting a slower one.
If the layer currently has 0 , this method will fade in the layer itself
and simply the `state`.
Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in a runtime build.
Starts fading in the `state` over the course of the `fadeDuration` while fading out all others in this
layer. Returns the `state`.
If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
method will allow it to complete the existing fade rather than starting a slower one.
If the layer currently has 0 , this method will fade in the layer itself
and simply the `state`.
Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in a runtime build.
Creates a state for the `transition` if it didn't already exist, then calls
or
depending on the .
Starts fading in the animation registered with the `key` over the course of the `fadeDuration` while fading
out all others in the same layer. Returns the animation's state (or null if none was registered).
If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
method will allow it to complete the existing fade rather than starting a slower one.
If the layer currently has 0 , this method will fade in the layer itself
and simply the `state`.
Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in a runtime build.
Manipulates the other parameters according to the `mode`.
Thrown if the is null when using or
.
[Assert-Only]
The maximum number of duplicate states that can be created by for
a single clip before it will start giving usage warnings. Default = 5.
[Assert-Conditional] Sets the .
This would not need to be a separate method if C# supported conditional property setters.
If the `state` is not currently at 0 , this method finds a copy of it
which is at 0 or creates a new one.
Thrown if the is null.
Thrown if more states have been created for this than the
allows.
Sets = 0 and calls on all animations
to stop them from playing and rewind them to the start.
Returns true if the `clip` is currently being played by at least one state.
Returns true if at least one animation is being played.
Returns true if the is playing and hasn't yet reached its end.
This method is called by so this object can be used as a custom yield
instruction to wait until it finishes.
Calculates the total of all states in this layer.
Invokes the callback of the state that is playing the animation
which triggered the event. Returns true if such a state exists (even if it doesn't have a callback).
[]
Gathers all the animations in this layer.
[Editor-Only] The Inspector display name of this layer.
The Inspector display name of this layer.
[Editor-Conditional]
Sets the Inspector display name of this layer. Note that layer names are Editor-Only so any calls to this
method will automatically be compiled out of a runtime build. returns the name.
Called by to append the details of this node.
Base class for wrapper objects in .
The internal object this node manages in the .
Must be set by . Failure to do so will throw the following exception throughout
the system when using this node: ": The playable passed as an argument is
invalid. To create a valid playable, please use the appropriate Create method".
[Internal] The managed by this node.
Indicates whether the is usable (properly initialised and not destroyed).
[Editor-Only] [Internal] Indicates whether the Inspector details for this node are expanded.
If the was set before was called, this method applies it.
Creates and assigns the managed by this node.
Destroys the .
Destroys the and creates a new one using .
Calls on this node and all its children recursively.
The at the root of the graph.
The managed by the .
This allows nodes defined outside the Animancer assembly to access the graph since it is internal.
The root which this node is connected to.
The object which receives the output of this node.
The index of the port this node is connected to on the parent's .
A negative value indicates that it is not assigned to a port.
Indices are generally assigned starting from 0, ascending in the order they are connected to their layer.
They will not usually change unless the changes or another state on the same layer is
destroyed so the last state is swapped into its place to avoid shuffling everything down to cover the gap.
The setter is internal so user defined states cannot set it incorrectly. Ideally,
should be able to set the port in its constructor and
should also be able to set it, but classes that further inherit from
there should not be able to change it without properly calling that method.
Constructs a new .
Connects the to the .
Disconnects the from the .
Calls as long as the is not
null.
Updates the for fading, applies it to this state's port on the parent mixer, and plays
or pauses the if its state is dirty.
If the 's is set to false, this method will
also connect/disconnect this node from the in the playable graph.
Returns true if the animation is playing and hasn't yet reached its end.
This method is called by so this object can be used as a custom yield
instruction to wait until it finishes.
Calls .
Returns null.
Does nothing.
The number of states using this node as their .
Returns the state connected to the specified `index` as a child of this node.
Thrown if this node cannot have children.
Called when a child is connected with this node as its .
Thrown if this node cannot have children.
Called when a child's is changed from this node to something else.
Thrown if this node cannot have children.
Connects the `state` to this node at its .
Thrown if the was already occupied.
[Internal]
Called by for any states connected to this mixer.
Adds the `state`s port to a list of spares to be reused by another state and notifies the root
.
Indicates whether child playables should stay connected to this mixer at all times (default false).
Ensures that all children of this node are connected to the .
Ensures that all children of this node which have zero weight are disconnected from the
.
Gets an enumerator for all of this node's child states.
The current blend weight of this node. Accessed via .
Indicates whether the weight has changed and should be applied to the parent mixer.
The current blend weight of this node which determines how much it affects the final output. 0 has no
effect while 1 applies the full effect of this node and values inbetween apply a proportional effect.
Setting this property cancels any fade currently in progress. If you don't wish to do that, you can use
instead.
Animancer Lite only allows this value to be set to 0 or 1 in a runtime build.
Calling immediately sets the weight of all states to 0
and the new state to 1. Note that this is separate from other values like
so a state can be paused at any point and still show its pose on the
character or it could be still playing at 0 weight if you want it to still trigger events (though states
are normally stopped when they reach 0 weight so you would need to explicitly set it to playing again).
Calling does not immediately change
the weights, but instead calls on every state to set their
and . Then every update each state's weight will move
towards that target value at that speed.
Sets the current blend weight of this node which determines how much it affects the final output.
0 has no effect while 1 applies the full effect of this node.
This method allows any fade currently in progress to continue. If you don't wish to do that, you can set
the property instead.
Animancer Lite only allows this value to be set to 0 or 1 in a runtime build.
Flags this node as having a dirty weight that needs to be applied next update.
[Internal]
Applies the to the connection between this node and its .
The desired which this node is fading towards according to the
.
The speed at which this node is fading towards the .
Calls and starts fading the over the course
of the `fadeDuration` (in seconds).
If the `targetWeight` is 0 then will be called when the fade is complete.
If the is already equal to the `targetWeight` then the fade will end
immediately.
Animancer Lite only allows a `targetWeight` of 0 or 1 and the default `fadeDuration` in a runtime build.
Called by .
Stops the animation and makes it inactive immediately so it no longer affects the output.
Sets = 0 by default.
Moves the towards the according to the
.
Determines whether OnAnimatorIK(int layerIndex) will be called on the animated object while this
node is active. The initial value is determined by .
This is equivalent to the "IK Pass" toggle in Animator Controller layers.
It requires Unity 2018.1 or newer, however 2018.3 or newer is recommended because a bug in earlier versions
of the Playables API caused this value to only take effect while a state was at == 1
which meant that IK would not work while fading between animations.
Determines whether this node is applying IK to the character's feet.
The initial value is determined by .
This is equivalent to the "Foot IK" toggle in Animator Controller states.
How fast the is advancing every frame.
1 is the normal speed.
A negative value will play the animation backwards.
Animancer Lite does not allow this value to be changed in a runtime build.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.Speed = 1;// Normal speed.
state.Speed = 2;// Double speed.
state.Speed = 0.5f;// Half speed.
state.Speed = -1;// Normal speed playing backwards.
}
The of each of this node's parents down the hierarchy, including the root
.
The of this node multiplied by the of each of its parents down the
hierarchy (including the root ) to determine the actual speed its output is
being played at.
Returns a detailed descrption of the current details of this node.
Appends a detailed descrption of the current details of this node.
Called by to append the details of this node.
A which can be used as a substitute for the
normally used to control an .
This class can be used as a custom yield instruction to wait until all animations finish playing.
The fade duration for any of the CrossFade methods to use if the caller doesn't specify.
[Internal] The containing this .
You can use if you need to access the graph in nodes defined outside the
Animancer assembly.
[Internal] The connected to the output.
[Internal] The which layers connect to.
[Internal] The which layers connect to.
An is the root of the graph so it has no parent.
[Pro-Only] The layers which each manage their own set of animations.
The states managed by this playable.
All of the nodes that need to be updated.
All of the objects that need to be updated early.
The that calls .
The component that is playing this .
The number of times the has changed. By storing this
value and later comparing the stored value to the current value, you can determine whether the state has
been changed since then, even it has changed back to the same state.
Determines what time source is used to update the .
How fast the of all animations is advancing every frame.
1 is the normal speed.
A negative value will play the animations backwards.
Setting this value to 0 would pause all animations, but calling is more efficient.
Animancer Lite does not allow this value to be changed in a runtime build.
void SetSpeed(AnimancerComponent animancer)
{
animancer.Playable.Speed = 1;// Normal speed.
animancer.Playable.Speed = 2;// Double speed.
animancer.Playable.Speed = 0.5f;// Half speed.
animancer.Playable.Speed = -1;// Normal speed playing backwards.
}
Indicates whether child playables should stay connected to the graph at all times.
Humanoid Rigs default this value to false so that playables will be disconnected from the graph
while they are at 0 weight which stops it from evaluating them every frame.
Generic Rigs default this value to true because they do not always animate the same standard set of
values so every connection change has a higher performance cost than with Humanoid Rigs which is generally
more significant than the gains for having fewer playables connected at a time.
The default is set by .
[SerializeField]
private AnimancerComponent _Animancer;
public void Initialise()
{
_Animancer.Playable.KeepChildrenConnected = true;
}
Since needs to clone an existing instance, we
keep a static template to avoid allocating an extra garbage one every time.
This is why the fields are assigned in OnPlayableCreate rather than being readonly with field initialisers.
Creates a new containing an .
The caller is responsible for calling on the returned object, except in Edit Mode
where it will be called automatically.
Consider calling before this method to give it a name.
[Internal] Called by Unity as it creates this .
[Editor-Conditional]
Sets the display name for the next call to give its .
Having this method separate from allows the
to compile it out of runtime builds which would
otherwise require #ifs on the caller side.
Returns "AnimancerPlayable (Graph Name)".
Plays this playable on the .
Plays this playable on the specified `animator`.
Indicates whether the is currently playing.
Resumes playing the if was called previously.
Freezes the at its current state.
If you call this method, you are responsible for calling to resume playing.
Evaluates all of the currently playing animations to apply their states to the animated objects.
Advances all currently playing animations by the specified amount of time (in seconds) and evaluates the
graph to apply their states to the animated objects.
Returns true as long as the hasn't been destroyed (such as by ).
Destroys the and all its layers and states. This operation cannot be undone.
Returns a detailed descrption of all currently playing states and other registered states.
Appends a detailed descrption of all currently playing states and other registered states.
Determines the default value of for all new states created in
this layer. Default false.
It requires Unity 2018.1 or newer, however 2018.3 or newer is recommended because a bug in earlier versions
of the Playables API caused this value to only take effect while at least one state was at
= 1 which meant that IK would not work while fading between animations.
Determines whether OnAnimatorIK(int layerIndex) will be called on the animated object for any
. The initial value is determined by when a new
state is created and setting this value will also set the default.
This is equivalent to the "IK Pass" toggle in Animator Controller layers, except that due to limitations in
the Playables API the layerIndex will always be zero.
It requires Unity 2018.1 or newer, however 2018.3 or newer is recommended because a bug in earlier versions
of the Playables API caused this value to only take effect while at least one state was at
= 1 which meant that IK would not work while fading between animations.
Determines the default value of for all new states created in this
layer. Default false.
Determines whether any of the in this layer are applying IK to the character's feet.
The initial value is determined by when a new state is created.
This is equivalent to the "Foot IK" toggle in Animator Controller states (applied to the whole layer).
Calls on the .
Stops all other animations, plays the `clip`, and returns its state.
The animation will continue playing from its current .
To restart it from the beginning you can use ...Play(clip, layerIndex).Time = 0;.
Stops all other animations, plays the `state`, and returns it.
The animation will continue playing from its current .
If you wish to force it back to the start, you can simply set the `state`s time to 0.
Creates a state for the `transition` if it didn't already exist, then calls
or
depending on the .
Stops all other animations, plays the animation registered with the `key`, and returns that
state. If no state is registered with the `key`, this method does nothing and returns null.
The animation will continue playing from its current .
If you wish to force it back to the start, you can simply set the returned state's time to 0.
on the returned state.
Starts fading in the `clip` over the course of the `fadeDuration` while fading out all others in the same
layer. Returns its state.
If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
method will allow it to complete the existing fade rather than starting a slower one.
If the layer currently has 0 , this method will fade in the layer itself
and simply the `state`.
Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in a runtime build.
Starts fading in the `state` over the course of the `fadeDuration` while fading out all others in the same
layer. Returns the `state`.
If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
method will allow it to complete the existing fade rather than starting a slower one.
If the layer currently has 0 , this method will fade in the layer itself
and simply the `state`.
Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in a runtime build.
Creates a state for the `transition` if it didn't already exist, then calls
or
depending on the .
Starts fading in the animation registered with the `key` over the course of the `fadeDuration` while fading
out all others in the same layer. Returns the animation's state (or null if none was registered).
If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
method will allow it to complete the existing fade rather than starting a slower one.
If the layer currently has 0 , this method will fade in the layer itself
and simply the `state`.
Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in a runtime build.
Gets the state registered with the , stops and rewinds it to the start, then
returns it.
Calls on the state registered with the `key` to stop it from playing and
rewind it to the start.
Calls on all animations to stop them from playing and rewind them to the
start.
Returns true if a state is registered with the and it is currently playing.
Returns true if a state is registered with the `key` and it is currently playing.
Returns true if at least one animation is being played.
Returns true if the `clip` is currently being played by at least one state in the specified layer.
This method is inefficient because it searches through every state to find any that are playing the `clip`,
unlike which only checks the state registered using the specified key.
Calculates the total of all states in this playable.
[]
Gathers all the animations in all layers.
Determines if any animations are still playing so this object can be used as a custom yield instruction.
Returns null.
Does nothing.
The called 'End' which is currently being triggered.
Invokes the callback of the state that is playing the animation
which triggered the event. Returns true if such a state exists (even if it doesn't have a callback).
If the and match the
, this method invokes the callback
and returns true.
If the has a float parameter above 0, this method returns that value.
Otherwise this method calls so if you aren't using an
Animation Event with the function name "End" you can just call that method directly.
[Warning]
You should not use an as a key.
Just call .
[Warning]
You should not use an as a key.
Just check .
Adds the `updatable` to the list of objects that need to be updated if it was not there already.
This method is safe to call at any time, even during an update.
The execution order of updatables is non-deterministic. Specifically, the most recently added will be
updated first and will change the order by swapping the last one
into the place of the removed element.
Removes the `updatable` from the list of objects that need to be updated.
This method is safe to call at any time, even during an update.
The last element is swapped into the place of the one being removed so that the rest of them do not need to
be moved down one place to fill the gap. This is more efficient, by means that the update order can change.
Adds the `node` to the list that need to be updated if it was not there already.
This method is safe to call at any time, even during an update.
The execution order of nodes is non-deterministic. Specifically, the most recently added will be
updated first and will change the order by swapping the last one
into the place of the removed element.
Removes the `node` from the list of objects that need to be updated.
This method is safe to call at any time, even during an update.
The last element is swapped into the place of the one being removed so that the rest of them do not need to
be moved down one place to fill the gap. This is more efficient, by means that the update order can change.
The object currently executing .
The current (most recent) .
After , this property will be left at its most recent value.
The current (most recent) .
uses this value to determine whether it has accessed the playable's time
since it was last updated in order to cache its value.
The index of the currently being updated.
The index of the currently being updated.
An error message for potential multithreading issues.
[Internal]
Called by the before the rest of the s are evaluated.
Calls and on everything
that needs it.
A which connects to a later port than the main layer mixer so that its
method gets called after all other playables are updated in order to call
on the .
See .
The this behaviour is connected to.
The underlying of this behaviour.
Creates a new for the `root`.
Called by Unity as it creates this .
Indicates whether this behaviour is connected to the and thus, whether it
will receive calls.
Called by the after the rest of the s are evaluated.
Calls on everything that needs it.
[Editor-Only]
Registers this object in the list of things that need to be updated in edit-mode.
Determines whether this playable should stay alive or be destroyed.
[Editor-Only]
Returns true if the `initial` mode was and the `current`
has changed to another mode or if the `initial` mode was something else and the `current` has changed to
.
[Editor-Only]
Draws the and lists.
[Pro-Only]
A list of s with methods to control their mixing and masking.
The at the root of the graph.
[Internal] The layers which each manage their own set of animations.
[Internal] The which blends the layers.
The number of layers that have actually been created.
[Internal] Constructs a new .
[Pro-Only] The number of layers in this list.
Thrown if the value is set higher than the . This is simply a safety measure,
so if you do actually need more layers you can just increase the limit.
Thrown if the value is set to a negative number.
[Pro-Only]
If the is below the specified `min`, this method increases it to that value.
[Pro-Only]
The maximum number of layers that can be created before an will
be thrown (default 4).
Lowering this value will not affect layers that have already been created.
To set this value automatically when the application starts, place the following method in any class:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void SetMaxLayerCount()
{
Animancer.AnimancerPlayable.LayerList.defaultCapacity = 8;
}
Otherwise you can set the of each individual list:
AnimancerComponent animancer;
animancer.Layers.Capacity = 8;
[Pro-Only]
If the is below the specified `min`, this method increases it to that value.
[Pro-Only]
The maximum number of layers that can be created before an will
be thrown. The initial capacity is determined by .
Lowering this value will destroy any layers beyond the specified value.
Any changes to this value after a layer has been created will cause the allocation of a new array and
garbage collection of the old one, so you should generally set it during initialisation.
Thrown if the value is not greater than 0.
[Pro-Only]
Creates and returns a new . New layers will override earlier layers by default.
Thrown if the value is set higher than the . This is simply a safety measure,
so if you do actually need more layers you can just increase the limit.
Returns the layer at the specified index. If it didn't already exist, this method creates it.
Returns an enumerator that will iterate through all layers.
Returns an enumerator that will iterate through all layers.
Returns an enumerator that will iterate through all states in each layer (not states inside mixers).
[]
Gathers all the animations in all layers.
[Pro-Only]
Checks whether the layer at the specified index is set to additive blending. Otherwise it will override any
earlier layers.
[Pro-Only]
Sets the layer at the specified index to blend additively with earlier layers (if true) or to override them
(if false). Newly created layers will override by default.
[Pro-Only]
Sets an to determine which bones the layer at the specified index will affect.
[Editor-Conditional]
Sets the Inspector display name of the layer at the specified index. Note that layer names are Editor-Only
so any calls to this method will automatically be compiled out of a runtime build.
The average velocity of the root motion of all currently playing animations, taking their current
into account.
[Internal]
Connects or disconnects all children from their parent .
A dictionary of s mapped to their .
The at the root of the graph.
Determines the used by every new when
it is created. Changing this value will not affect existing instances.
- The default is false, which will use a .
- Setting it to true will use a , which is faster but does not
work for value types such as enums because it uses .
mapped to .
[Internal] Constructs a new .
The number of states that have been registered with a .
Creates and returns a new to play the `clip`.
This method uses to determine the .
To create a state on a different layer, call animancer.Layers[x].CreateState(clip) instead.
Creates and returns a new to play the `clip` and registers it with the `key`.
To create a state on a different layer, call animancer.Layers[x].CreateState(key, clip) instead.
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls for each of the specified clips.
If you only want to create a single state, use .
Calls for each of the specified `clips`.
If you only want to create a single state, use .
The on layer 0.
Specifically, this is the state that was most recently started using any of the Play methods on that layer.
States controlled individually via methods in the itself will not register in
this property.
Calls then returns the state registered with that key, or null if none exists.
Returns the state registered with the , or null if none exists.
Returns the state registered with the `key`, or null if none exists.
Calls then passes the key to
and returns the result.
Passes the into
and returns the result.
If a state is registered with the `key`, this method outputs it as the `state` and returns true. Otherwise
`state` is set to null and this method returns false.
Calls and returns the state which registered with that key or creates one if it
doesn't exist.
If the state already exists but has the wrong , the `allowSetClip`
parameter determines what will happen. False causes it to throw an while
true allows it to change the . Note that the change is somewhat costly to
performance to use with caution.
Returns the state registered with the `transition`s if there is one. Otherwise
this method uses to create a new one and registers it with
that key before returning it.
Returns the state which registered with the `key` or creates one if it doesn't exist.
If the state already exists but has the wrong , the `allowSetClip`
parameter determines what will happen. False causes it to throw an while
true allows it to change the . Note that the change is somewhat costly to
performance to use with caution.
Thrown if the `key` is null.
See also:
[Internal]
Registers the `state` in this dictionary so the `key` can be used to get it later on using
.
[Internal]
Removes the `state` from this dictionary.
Returns an enumerator that will iterate through all states in each layer (not states inside mixers).
[]
Gathers all the animations in all layers.
Calls on the state associated with the `clip` (if any).
Returns true if the state existed.
Calls on the state associated with the
(if any). Returns true if the state existed.
Calls on the state associated with the `key` (if any).
Returns true if the state existed.
Calls on each of the `clips`.
Calls on each of the `clips`.
Calls on all states gathered by
.
Calls on all states gathered by
.
Destroys all states connected to all layers (regardless of whether they are actually registered in this
dictionary).
[Warning]
You should not use an as a key.
The whole point of a key is to identify a state in the first place.
[Warning]
You should not use an as a key.
The whole point of a key is to identify a state in the first place.
[Warning]
You should not use an as a key.
The whole point of a key is to identify a state in the first place.
[Warning]
You should not use an as a key.
Just call .
Base class for all states in an graph.
Each state is a wrapper for a in the .
This class can be used as a custom yield instruction to wait until the animation either stops playing or reaches its end.
There are various different ways of getting a state:
-
Use one of the state's constructors. Generally the first parameter is a layer or mixer which will be used as
the state's parent. If not specified, you will need to call SetParent manually. Also note than an
AnimancerComponent can be implicitly cast to its first layer.
-
AnimancerController.CreateState creates a new ClipState. You can optionally specify a custom `key` to
register it in the dictionary instead of the default (the `clip` itself).
-
AnimancerController.GetOrCreateState looks for an existing state registered with the specified `key` and only
creates a new one if it doesn’t already exist.
-
AnimancerController.GetState returns an existing state registered with the specified `key` if there is one.
-
AnimancerController.TryGetState is similar but returns a bool to indicate success and returns the `state`
as an out parameter.
-
AnimancerController.Play and CrossFade also return the state they play.
Note that when inheriting from this class, the field must be assigned in the
constructor to avoid throwing s throughout the system.
The at the root of the graph.
The object which receives the output of the .
Connects this state to the `parent` mixer at the specified `index`.
See also to connect a state to an available port on a
layer.
[Internal]
Called by if the specified
port is already occupied so it can be cleared without triggering any other calls.
The of this state multiplied by the of each of
its parents down the hierarchy to determine how much this state affects the final output.
Thrown if this state has no .
The root which this state is connected to.
The index of the this state is connected to (determined by the
).
The object used to identify this state in the root dictionary.
Can be null.
The which this state plays (if any).
Thrown if this state type doesn't have a clip and you try to set it.
The main object to show in the Inspector for this state (if any).
Thrown if this state type doesn't have a main object and you try to set it.
Thrown if you try to assign something this state can't use.
Sets the `currentObject` and calls . If the `currentObject` was
being used as the then it is changed as well.
The average velocity of the root motion caused by this state.
Is the automatically advancing?
Has changed since it was last applied to the .
Playables start playing by default so we start dirty to pause it during the first update (unless
is set to true before that).
Is the automatically advancing?
void IsPlayingExample(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.States.GetOrCreate(clip);
if (state.IsPlaying)
Debug.Log(clip + " is playing");
else
Debug.Log(clip + " is paused");
state.IsPlaying = false;// Pause the animation.
state.IsPlaying = true;// Unpause the animation.
}
Returns true if this state is playing and is at or fading towards a non-zero
.
Returns true if this state is not playing and is at 0 .
Plays this animation immediately, without any blending.
Sets = true, = 1, and clears the
.
This method does not change the so it will continue from its current value.
Stops the animation and makes it inactive immediately so it no longer affects the output.
Sets = 0, = false, = 0, and
clears the .
If you only want to freeze the animation in place, you can set = false instead. Or
to freeze all animations, you can call .
Called by . Clears the .
The current time of the , retrieved by whenever the
is different from the .
Indicates whether the needs to be assigned to the next update.
executes after all other playables, at which point changes can still be made to
their time but not their weight which means that if we set the time immediately then it can be out of sync
with the weight. For example, if an animation ends and you play another, the first animation would be
stopped and rewinded to the start but would still be at full weight so it would show its first frame before
the new animation actually takes effect (even if the previous animation was not looping).
So instead, we simply delay setting the actual playable time until the next update so that time and weight
are always in sync.
The from when the was last retrieved from the
.
The number of seconds that have passed since the start of this animation.
This value will continue increasing after the animation passes the end of its while
the animated object either freezes in place or starts again from the beginning according to whether it is
looping or not.
Animancer Lite does not allow this value to be changed in a runtime build (except resetting it to 0).
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
// Skip 0.5 seconds into the animation:
state.Time = 0.5f;
// Skip 50% of the way through the animation (0.5 in a range of 0 to 1):
state.NormalizedTime = 0.5f;
// Skip to the end of the animation and play backwards.
state.NormalizedTime = 1;
state.Speed = -1;
}
This property internally uses whenever the value is out of date or gets changed.
The internal implementation of which directly gets and sets the underlying value.
Setting this value actually calls twice to ensure that animation
events aren't triggered incorrectly. Calling it only once would trigger any animation events between the
previous time and the new time. So if an animation plays to the end and you set the time back to 0 (such as
by calling or playing a different animation), the next time that animation played it
would immediately trigger all of its events, then play through and trigger them normally as well.
The of this state as a portion of the animation's , meaning the
value goes from 0 to 1 as it plays from start to end, regardless of how long that actually takes.
This value will continue increasing after the animation passes the end of its while
the animated object either freezes in place or starts again from the beginning according to whether it is
looping or not.
The fractional part of the value (NormalizedTime % 1) is the percentage (0-1) of progress in the
current loop while the integer part ((int)NormalizedTime) is the number of times the animation has
been looped.
Animancer Lite does not allow this value to be changed to a value other than 0 in a runtime build.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
// Skip 0.5 seconds into the animation:
state.Time = 0.5f;
// Skip 50% of the way through the animation (0.5 in a range of 0 to 1):
state.NormalizedTime = 0.5f;
// Skip to the end of the animation and play backwards.
state.NormalizedTime = 1;
state.Speed = -1;
}
Prevents the from being applied.
The number of seconds the animation will take to play fully at its current
.
Setting this value modifies the , not the .
Animancer Lite does not allow this value to be changed in a runtime build.
For the time remaining from now until it reaches the end, use instead.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.Duration = 1;// Play fully in 1 second.
state.Duration = 2;// Play fully in 2 seconds.
state.Duration = 0.5f;// Play fully in half a second.
state.Duration = -1;// Play backwards fully in 1 second.
state.NormalizedTime = 1; state.Duration = -1;// Play backwards from the end in 1 second.
}
The number of seconds the animation will take to reach the end at its current .
Setting this value modifies the , not the .
Animancer Lite does not allow this value to be changed in a runtime build.
For the time it would take to play fully from the start, use instead.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.RemainingDuration = 1;// Play from the current time to the end in 1 second.
state.RemainingDuration = 2;// Play from the current time to the end in 2 seconds.
state.RemainingDuration = 0.5f;// Play from the current time to the end in half a second.
state.RemainingDuration = -1;// Play backwards from the current time to the end in 1 second.
}
The total time this state takes to play in seconds (when Speed = 1).
Indicates whether this state will loop back to the start when it reaches the end.
Constructs a new .
Updates the for fading, applies it to this state's port on the parent
mixer, and plays or pauses the if its state is dirty.
If the 's is set to false, this
method will also connect/disconnect this node from the in the playable graph.
Destroys the .
[]
Gathers all the animations in this state.
Returns true if the animation is playing and has not yet passed the
.
This method is called by so this object can be used as a custom yield
instruction to wait until it finishes.
[Editor-Only] Returns a custom drawer for this state.
Called by to append the details of this node.
Returns the hierarchy path of this state through its s.
Appends the hierarchy path of this state through its s.
Appends "[Index] -> GetType().Name".
Base class for serializable s which can create a particular type of
when passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
Even though it has the , this class won't actually get serialized
by Unity because it's generic and abstract. Each child class still needs to include the attribute.
[] The amount of time the transition will take (in seconds).
Thrown when setting the value to a negative number.
[]
Indicates what the value of will be for the created state.
Returns false unless overridden.
[]
Determines what to start the animation at.
Returns unless overridden.
[]
Determines how fast the animation plays (1x = normal speed).
Returns 1 unless overridden.
[]
The maximum amount of time the animation is expected to take (in seconds).
[] Events which will be triggered as the animation plays.
The state that was created by this object. Specifically, this is the state that was most recently
passed into (usually by ).
You can use or
to get or create the state for a
specific object.
is simply a shorthand for casting this to .
The state that was created by this object. Specifically, this is the state that was most recently
passed into (usually by ).
You can use or
to get or create the state for a
specific object.
This property is shorthand for casting the to .
Thrown if the is not actually a . This should only
happen if a different type of state was created by something else and registered using the
, causing this to pass that
state into instead of calling to make the correct type of
state.
Indicates whether this transition can create a valid .
The which the created state will be registered with.
By default, a transition is used as its own , but this property can be overridden.
When a transition is passed into , this property
determines which will be used.
Creates and returns a new connected to the `layer`.
Creates and returns a new connected to the `layer`.
[]
Called by to set the
and apply any other modifications to the `state`.
This method also clears the if necessary, so it will re-cast the
when it gets accessed again.
[Editor-Only] Don't use Inspector Gadgets Nested Object Drawers.
[Editor-Only] Adds context menu functions for this transition.
[Editor-Only] Adds context menu functions for this transition.
The that manages the events of this state.
This field is null by default, acquires its reference from an when accessed, and
if it contains no events at the end of an update it releases the reference back to the pool.
A list of s that will occur while this state plays as well as one that
specifically defines when this state ends.
Animancer Lite does not allow the use of events in a runtime build, except for
.
Indicates whether this state currently has an (since accessing the
would automatically get one from the ).
The number of spare items in the for .
If the is less than the specified value, this method increases it to that
value by creating new objects.
The capacity of the internal list in the for .
An which manages the triggering of events.
If the `state` has no , this method gets one from the
.
Returns this to the .
If the was acquired from the , this
method clears it. Otherwise it simply discards the reference.
This system accounts for external modifications to the sequence, but modifying it while checking which
of its events to update is not allowed because it would be impossible to efficiently keep track of
which events have been checked/invoked and which still need to be checked.
If the state has zero length, trigger its end event every frame.
Returns "EventRunner (Target State)".
A wrapper which allows access to the value of a property that is controlled by animations.
Requires Unity 2019.1+.
The type of property being wrapped.
The value of the target property when using .
Thrown if not using .
The value of the target property when using .
Thrown if not using .
The value of the target property when using .
Thrown if not using .
The value of the target property when using .
Thrown if not using .
The value of the target property when using .
Thrown if not using .
The value of the target property when using .
Thrown if not using .
Creates a new to wrap a property with the specified `name`.
Creates a new to wrap a property with the specified `name`.
Creates a new to wrap a property with the specified `name`.
Cleans up this .
An which plays an .
The which this state plays.
The which this state plays.
The which this state plays.
The .
The .
The average velocity of the root motion caused by this state.
Determines whether OnAnimatorIK(int layerIndex) will be called on the animated object.
The initial value is determined by .
This is equivalent to the "IK Pass" toggle in Animator Controller layers.
It requires Unity 2018.1 or newer, however 2018.3 or newer is recommended because a bug in earlier versions
of the Playables API caused this value to only take effect while a state was at
== 1 which meant that IK would not work while fading between animations.
Indicates whether this state is applying IK to the character's feet.
The initial value is determined by .
This is equivalent to the "Foot IK" toggle in Animator Controller states.
Creates a new and sets its .
Creates and assigns the managed by this node.
Returns a string describing the type of this state and the name of the .
Destroys the .
[Editor-Only] Returns a for this state.
[Editor-Only] Draws the Inspector GUI for a .
Indicates whether the animation has an event called "End".
Constructs a new to manage the Inspector GUI for the `state`.
Draws the details of the target state in the GUI.
Validates the type compared to the owner's type.
Adds the details of this state to the menu.
A serializable which can create a when passed
into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
[] The animation to play.
The will be used as the for the created state to be
registered with.
[]
Determines how fast the animation plays (1x = normal speed, 2x = double speed).
[]
Determines what to start the animation at.
The default value is which indicates that this value is not used so the
animation will continue from its current time.
If this transition will set the , then it needs to use
.
[] Returns .
[]
The maximum amount of time the animation is expected to take (in seconds).
Indicates whether this transition can create a valid .
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
Called by to apply the
and .
Adds the to the collection.
[Editor-Only] Draws the Inspector GUI for a .
Constructs a new .
Determines how works.
Calculate the fade speed to bring the from 0 to 1 over the specified
fade duration (in seconds), regardless of the actual starting weight.
A fade duration of 0.5 would make the fade last for 0.5 seconds, regardless of how long the animation is.
This is generally the same as but differs when starting the fade from a
non-zero , for example:
- Fade Duration: 0.25
- To fade from 0 to 1 with either mode would get a speed of 4 and take 0.25 seconds
- To fade from 0.5 to 1 with would get a speed of 2 and take 0.25 seconds.
It has half the distance to cover so it goes half as fast to maintain the expected duration.
- To fade from 0.5 to 1 with would get a speed of 4 and take 0.125 seconds.
It gets the same speed regardless of the distance to cover, so with less distance it completes faster.
Thrown if the is null.
Thrown if more states have been created for the than the
allows.
Calculate the fade speed to bring the to the target value over the
specified fade duration (in seconds).
A fade duration of 0.5 would make the fade last for 0.5 seconds, regardless of how long the animation is.
This is generally the same as , but differs when starting the fade from a
non-zero :
- Fade Duration: 0.25
- To fade from 0 to 1 with either mode would get a speed of 4 and take 0.25 seconds
- To fade from 0.5 to 1 with would get a speed of 2 and take 0.25 seconds.
It has half the distance to cover so it goes half as fast to maintain the expected duration.
- To fade from 0.5 to 1 with would get a speed of 4 and take 0.125 seconds.
It gets the same speed regardless of the distance to cover, so with less distance it completes faster.
This was how fading worked prior to the introduction of s in Animancer v4.0.
If the state is not currently at 0 , this mode will use
to get a copy of it that is at 0 weight so it can
fade the copy in while the original fades out with all other states.
Using this mode repeatedly on subsequent frames will probably have undesirable effects because it will
create a new state each time. In such a situation you most likely want instead.
This mode only works for s does not know how to duplicate other state types.
This can be useful when you want to repeat an action while the previous animation is still fading out.
For example, if you play an 'Attack' animation, it ends and starts fading back to 'Idle', and while it is
doing so you want to start another 'Attack'. The previous 'Attack' can't simply snap back to the start, so
you can use this method to create a second 'Attack' state to fade in while the old one fades out.
Like , except that the fade duration is multiplied by the animation length.
Like , except that the fade duration is multiplied by the animation length.
Like , except that the fade duration is multiplied by the animation length.
[Pro-Only]
An which plays a .
The which this state plays.
The which this state plays.
The which this state plays.
The .
Constructs a new to play the `asset`.
Creates and assigns the managed by this node.
The objects controlled by each Timeline Track.
Sets the .
Returns a string describing the type of this state and the name of the .
Destroys the .
A serializable which can create a when
passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
[] The asset to play.
The will be used as the for the created state to
be registered with.
[]
Determines how fast the animation plays (1x = normal speed, 2x = double speed).
[]
Determines what to start the animation at.
The default value is which indicates that this value is not used so the
animation will continue from its current time.
If this transition will set the , then it needs to use
.
[] The objects controlled by each of the tracks in the Timeline Asset.
[]
The maximum amount of time the animation is expected to take (in seconds).
Indicates whether this transition can create a valid .
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
Called by to apply the
and .
Gathers all the animations associated with this object.
[Editor-Only] Draws the Inspector GUI for a .
Constructs a new .
Various string constants used throughout Animancer.
The standard prefix for .
The base value for to group
"Assets/Create/Animancer/..." menu items just under "Avatar Mask".
The URL of the website where the Animancer documentation is hosted.
The URL of the website where the Animancer API documentation is hosted.
The email address which handles support for Animancer.
The conditional compilation symbol for editor-only code.
The conditional compilation symbol for assertions.
[Internal]
A prefix for tooltips on Pro-Only features.
"[Pro-Only] " in Animancer Lite or "" in Animancer Pro.
[Internal] [Lite-Only]
Disables member renaming in a [].
[Editor-Only] URLs of various documentation pages.
Enforces various rules throughout the system, most of which are compiled out if UNITY_ASSERTIONS is not defined
(by default, it is defined in the Unity Editor and in Development Builds).
[Assert]
Throws if the `clip` is marked as .
[Assert]
Throws if the is not the `root`.
[Assert]
Throws if the `state` was not actually assigned to its specified in
the `states`.
Thrown if the is larger than the number of `states`.
[Internal] [Lite-Only]
Ensures that only the can be used (warn in Editor,
enforce at Runtime).
[Internal] [Lite-Only]
Ensures that only 0 or 1 weight can be used (warn in Editor, enforce at Runtime).
[Internal] [Lite-Only]
Ensures that only 1 speed can be used (warn in Editor, enforce at Runtime).
[Internal] [Lite-Only]
Ensures that only 0 time can be used (warn in Editor, enforce at Runtime).
[Internal] [Lite-Only]
Ensures that only inbuilt types can be used (warn in Editor, enforce at
Runtime).
[Internal] [Lite-Only]
Ensures that only inbuilt types can be used (warn in Editor, enforce at
Runtime).
[Lite-Only]
A message which explains that some features are only available in the Unity Editor for trial purposes in
Animancer Lite, but not at runtime.
[Lite-Only]
When a Pro-Only feature is used it will log a message and decrement this value (default 0). Once it becomes
negative, no more messages will be logged.
[Internal] [Lite-Only]
Logs a message the first time a Pro-Only feature is used, then does nothing on subsequent calls.
Interface for components that manage an .
Despite the name, this interface is not necessarily limited to only components.
This interface allows Animancer Lite to reference an inside the pre-compiled
DLL while allowing that component to remain outside as a regular script. Otherwise everything would need to be
in the DLL which would cause Unity to lose all the script references when upgrading from Animancer Lite to Pro.
Indicates whether this component will be updated.
The this component is attached to.
The component which this script controls.
The internal system which manages the playing animations.
Indicates whether the has been initialised (is not null).
Determines whether the object will be reset to its original values when disabled.
Determines when animations are updated and which time source is used. This property is mainly a wrapper
around the .
Returns the dictionary key to use for the `clip`.
[Editor-Only] The name of the serialized backing field for the property.
[Editor-Only] The what was first used when this script initialised.
Proxy for an identical interface introduced in Unity 2018.3 to have a class provide its own list of
s to the Animation Window without an Animator Controller.
A variant of which uses a instead of a
so that it can take a to efficiently avoid adding duplicates.
contains various extension methods for this purpose.
still needs to be the main point of entry for the Animation Window, so this
interface is only used internally.
Gathers all the animations associated with this object.
Interface for components to indicate which is the root of a character when
is called.
The to search for s beneath.
Implementing this interface in a will automatically inherit this property so
you do not need to do anything else:
public class MyComponent : MonoBehaviour, IAnimancerRoot
{
}
But if you want to have your script point to a different object as the root, you can explicitly implement
this property:
public class MyComponent : MonoBehaviour, IAnimancerRoot
{
Transform IAnimancerRoot.transform { get { return ???; } }
}
Exposes a object that can be used for dictionaries and hash sets.
An identifier object that can be used for dictionaries and hash sets.
Interface for objects that manage a .
The object which receives the output of the .
The managed by this object.
Indicates whether child playables should stay connected to the graph at all times.
If false, playables will be disconnected from the graph while they are at 0 weight to stop it from
evaluating them every frame.
How fast the is advancing every frame.
1 is the normal speed.
A negative value will play the animation backwards.
Animancer Lite does not allow this value to be changed in a runtime build.
void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
{
var state = animancer.Play(clip);
state.Speed = 1;// Normal speed.
state.Speed = 2;// Double speed.
state.Speed = 0.5f;// Half speed.
state.Speed = -1;// Normal speed playing backwards.
}
An object that can create an and manage the details of how it should be played.
Transitions are generally used as arguments for .
Creates and returns a new connected to the `layer`.
The first time a transition is used on an object, this method is called to create the state and register it
in the internal dictionary using the so that it can be reused later on.
When a transition is passed into , this property
determines which will be used.
The amount of time the transition should take (in seconds).
Called by to apply any modifications to the `state`.
Unlike , this method is called every time the transition is used so it can do
things like set the or .
An with some additional details for the Unity Editor GUI.
Indicates what the value of will be for the created state.
Determines what to start the animation at.
Determines how fast the animation plays (1x = normal speed).
The maximum amount of time the animation is expected to take (in seconds).
Indicates whether this transition can create a valid .
[Editor-Only] Adds context menu functions for this transition.
An object that can be updated during .
Register to receive updates using and stop
receiving updates using .
public sealed class UpdatableBehaviour : MonoBehaviour, IUpdatable
{
[SerializeField] private AnimancerComponent _Animancer;
private void OnEnable()
{
_Animancer.Playable.RequireUpdate(this);
}
private void OnEnable()
{
_Animancer.Playable.CancelUpdate(this);
}
public void EarlyUpdate()
{
// Called at the start of every Animator update before the playables get updated.
}
public void LateUpdate()
{
// Called at the end of every Animator update after the playables get updated.
}
public void OnDestroy()
{
// Called by AnimancerPlayable.Destroy if this object is currently being updated.
}
}
Called at the start of every update before the playables get updated.
The determines when it updates.
Called at the end of every update after the playables get updated.
The determines when it updates.
This method has nothing to do with .LateUpdate().
Called by if this object is currently being updated.
[Pro-Only]
An which blends an array of other states together based on a two dimensional
parameter and thresholds using Gradient Band Interpolation.
This mixer type is similar to the 2D Freeform Cartesian Blend Type in Mecanim Blend Trees.
Precalculated values to speed up the recalculation of weights.
Indicates whether the need to be recalculated.
Gets or sets Parameter.x.
Gets or sets Parameter.y.
Called whenever the thresholds are changed. Indicates that the internal blend factors need to be
recalculated and calls .
Recalculates the weights of all based on the current value of the
and the .
Appends the `parameter` in a viewer-friendly format.
The number of parameters being managed by this state.
Returns the name of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the type of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Sets the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
[Pro-Only]
An which blends an array of other states together based on a two dimensional
parameter and thresholds using Polar Gradient Band Interpolation.
This mixer type is similar to the 2D Freeform Directional Blend Type in Mecanim Blend Trees.
Precalculated magnitudes of all thresholds to speed up the recalculation of weights.
Precalculated values to speed up the recalculation of weights.
Indicates whether the need to be recalculated.
The multiplier that controls how much an angle (in radians) is worth compared to normalized distance.
Gets or sets Parameter.x.
Gets or sets Parameter.y.
Called whenever the thresholds are changed. Indicates that the internal blend factors need to be
recalculated and calls .
Recalculates the weights of all based on the current value of the
and the thresholds.
Appends the `parameter` in a viewer-friendly format.
The number of parameters being managed by this state.
Returns the name of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the type of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Sets the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
[Pro-Only]
An which blends an array of other states together using linear interpolation
between the specified thresholds.
This mixer type is similar to the 1D Blend Type in Mecanim Blend Trees.
Initialises the and with one
state per clip and assigns thresholds evenly spaced between the specified min and max (inclusive).
Initialises the with two ports and connects two states to them for
the specified clips at the specified thresholds (default 0 and 1).
Initialises the with three ports and connects three states to them for
the specified clips at the specified thresholds (default -1, 0, and 1).
Called whenever the thresholds are changed. Indicates that needs to
be called by the next if UNITY_ASSERTIONS is defined, then calls
.
Throws an if the thresholds are not sorted from lowest to highest without
any duplicates.
Thrown if the thresholds have not been initialised.
Recalculates the weights of all based on the current value of the
and the thresholds.
Assigns the thresholds to be evenly spaced between the specified min and max (inclusive).
The number of parameters being managed by this state.
Returns the name of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the type of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Sets the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
A serializable which can create a when
passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
Sorts all states so that their thresholds go from lowest to highest.
This method uses Bubble Sort which is inefficient for large numbers of states.
[Editor-Only] Draws the Inspector GUI for a .
Draws the GUI of the threshold at the specified `index`.
will add some functions to the menu.
Adds functions to the `menu` relating to the thresholds.
[Pro-Only]
An which blends multiple child states. Unlike other mixers, this class does not
perform any automatic weight calculations, it simple allows you to control the weight of all states manually.
This mixer type is similar to the Direct Blend Type in Mecanim Blend Trees.
The states managed by this mixer.
Returns the array.
The number of states using this mixer as their .
Returns the state connected to the specified `index` as a child of this mixer.
Assigns the `state` as a child of this mixer.
The weighted average of each child state according to their
.
The weighted average of each child state according to their
.
Initialises this mixer with the specified number of ports which can be filled individually by .
Initialises this mixer with one state per clip.
Indicates whether the child states of this mixer have been initialised.
Creates and returns a new to play the `clip` with this mixer as its parent.
Creates and returns a new to play the `clip` with this
as its parent.
Connects the `state` to this mixer at its .
Disconnects the `state` from this mixer at its .
Destroys the of this mixer and its .
Calculates the sum of the of all child states.
Destroys all connected to this mixer. This operation cannot be undone.
Does nothing. Manual mixers do not automatically recalculate their weights.
Sets the weight of all states after the `previousIndex` to 0.
Returns the state at the specified `index` if it is not null, otherwise increments the index and checks
again. Returns null if no state is found by the end of the array.
Divides the weight of all states by the `totalWeight` so that they all add up to 1.
Gets a user-friendly key to identify the `state` in the Inspector.
Base class for serializable s which can create a particular type of
when passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
Even though it has the , this class won't actually get serialized
by Unity because it's generic and abstract. Each child class still needs to include the attribute.
[]
Determines how fast the mixer plays (1x = normal speed, 2x = double speed).
[]
The to use for each state in the mixer.
[]
The to use for each state in the mixer.
If the size of this array doesn't match the , it will be ignored.
[]
The flags for each state in the mixer.
The array can be null or empty. Any elements not in the array will be treated as true.
[]
Returns true is any of the are looping.
[]
The maximum amount of time the animation is expected to take (in seconds).
Initialises the immediately after it is created.
Called by to apply the .
Adds the to the collection.
A serializable which can create a when
passed into .
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
Creates and returns a new connected to the `layer`.
This method also assigns it as the .
[Editor-Only] Draws the Inspector GUI for a .
The property this drawer is currently drawing.
Normally each property has its own drawer, but arrays share a single drawer for all elements.
The field.
The field.
The field.
Gather the details of the `property`.
This method gets called by every and call since
Unity uses the same instance for each element in a collection, so it
needs to gather the details associated with the current property.
Called every time a `property` is drawn to find the relevant child properties and store them to be
used in and .
Called every time a `property` is drawn to find the relevant child properties and store them to be
used in and .
Adds a menu item that will call then run the specified
`function`.
Adds a menu item that will call then run the specified
`function`.
Calculates the number of vertical pixels the `property` will occupy when it is drawn.
Draws the root `property` GUI and calls
for each of its children.
Splits the specified `area` into separate sections.
Draws the headdings of the state list.
Draws an "Animation" header.
Draws a "Speed" header.
Recalculates the depending on the of
their animations so that they all take the same amount of time to play fully.
Initialises every element in the array from the `start` to the end of
the array to contain a value of 1.
Draws a "Sync" header.
Draws the GUI for a header dropdown button.
Calculates the height of the state at the specified `index`.
Draws the GUI of the state at the specified `index`.
Draws the GUI of the state at the specified `index`.
Draws the GUI of the state at the specified `index`.
Draws a toggle to enable or disable for the child at
the specified `index`.
Called when adding a new state to the list to ensure that any other relevant arrays have new
elements added as well.
Called when removing a state from the list to ensure that any other relevant arrays have elements
removed as well.
Removes the specified array element from the `property`.
If the element is not at its default value, the first call to
will only reset it, so this method will
call it again if necessary to ensure that it actually gets removed.
Called when reordering states in the list to ensure that any other relevant arrays have their
corresponding elements reordered as well.
Calls and .
If every element in the array is 1, this method sets the array size to 0.
Removes any true elements from the end of the array.
[Pro-Only]
Base class for s which blend other states together.
Mixers should keep child playables connected to the graph at all times.
An has no .
Returns the collection of states connected to this mixer. Note that some elements may be null.
Getting an enumerator that automatically skips over null states is slower and creates garbage, so
internally we use this property and perform null checks manually even though it increases the code
complexity a bit.
Returns an enumerator which will iterate through each state connected to this mixer.
Indicates whether the weights of all child states should be recalculated.
Determines whether the states in this mixer are playing.
Returns true if any child state is looping.
Indicates which children should have their modified in order to keep
their at approximately the same value.
The array can be null or empty. Any elements not in the array will be treated as true.
The is modified to allow each state to trigger its events properly
where setting the directly would prevent any events.
Constructs a new
Creates and assigns the managed by this node.
Creates and returns a new to play the `clip` with this mixer as its parent.
The number of states using this mixer as their .
Returns the state connected to the specified `index` as a child of this mixer.
Updates the time of this mixer and all of its child states.
Applies the effects of .
Recalculates the weights of all child states based on the current value of the
and the thresholds.
Overrides of this method must set = false.
Sets for all .
The average velocity of the root motion caused by this state.
Recalculates the of all child states so that they add up to 1.
Thrown if there are any states with no .
Gets a user-friendly key to identify the `state` in the Inspector.
Returns a string describing the type of this mixer and the name of s connected to it.
Called by to append the details of this node.
[]
Gathers all the animations in this state.
The number of parameters being managed by this state.
Returns the name of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the type of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Returns the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
Sets the value of a parameter being managed by this state.
Thrown if this state doesn't manage any parameters.
[Editor-Only] Returns a for this state.
[Editor-Only] Draws the Inspector GUI for an .
Constructs a new to manage the Inspector GUI for the `state`.
The number of parameters being managed by the target state.
Returns the name of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Returns the type of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Returns the value of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Sets the value of a parameter being managed by the target state.
Thrown if the target state doesn't manage any parameters.
Adds the details of this state to the menu.
Base class for serializable s which can create a particular type of
when passed into
.
Unfortunately the tool used to generate this documentation does not currently support nested types with
identical names, so only one Transition class will actually have a documentation page.
Even though it has the , this class won't actually get serialized
by Unity because it's generic and abstract. Each child class still needs to include the attribute.
[]
The parameter values at which each of the states are used and blended.
[]
The initial parameter value to give the mixer when it is first created.
Initialises the immediately after it is created.
A serializable which can create a or
when passed into
.
A type of that can be created by a .
[]
The type of that this transition will create.
Creates and returns a new or
depending on the connected to the `layer`.
This method also assigns it as the .
[Editor-Only]
Draws the Inspector GUI for a .
Constructs a new using the a wider `thresholdWidth` than usual to accomodate
both the X and Y values.
will add some functions to the menu.
Adds functions to the `menu` relating to the thresholds.
[Editor-Only] Draws the Inspector GUI for a .
This class would be nested inside , but the generic parameters
cause problems in Unity 2019.3.
The number of horizontal pixels the "Threshold" label occupies.
The number of horizontal pixels the word "Threshold" occupies when drawn with the
style.
Constructs a new using the default .
Constructs a new using a custom width for its threshold labels.
The serialized of the
.
Called every time a `property` is drawn to find the relevant child properties and store them to be
used in and
.
Splits the specified `area` into separate sections.
Draws the headdings of the state list.
Draws the GUI of the state at the specified `index`.
Draws the GUI of the threshold at the specified `index`.
Called when adding a new state to the list to ensure that any other relevant arrays have new
elements added as well.
Called when removing a state from the list to ensure that any other relevant arrays have elements
removed as well.
Called when reordering states in the list to ensure that any other relevant arrays have their
corresponding elements reordered as well.
Indicates whether will add anything to the menu.
Adds functions to the `menu` relating to the thresholds.
[Pro-Only]
Base class for mixers which blend an array of child states together based on a .
The parameter values at which each of the child states are used and blended.
The value used to calculate the weights of the child states.
Returns the value of the threshold associated with the specified index.
Sets the value of the threshold associated with the specified index.
Assigns the specified array as the thresholds to use for blending.
WARNING: if you keep a reference to the `thresholds` array you must call
whenever any changes are made to it, otherwise this mixer may not blend correctly.
If the don't have the same as the
, this method allocates and assigns a new array of that size.
Called whenever the thresholds are changed. By default this method simply indicates that the blend weights
need recalculating but it can be overridden by child classes to perform validation checks or optimisations.
Calls `calculate` for each of the and stores the returned value as
the threshold for that state.
Initialises this mixer with the specified number of ports which can be filled individually by .
Initialises the and with one
state per clip and assigns the `thresholds`.
WARNING: if you keep a reference to the `thresholds` array, you must call
whenever any changes are made to it, otherwise this mixer may not blend
correctly.
Initialises the and with one
state per clip and assigns the thresholds by calling `calculateThreshold` for each state.
Creates and returns a new to play the `clip` with this
as its parent, connects it to the specified `index`, and assigns the
`threshold` for it.
Gets a user-friendly key to identify the `state` in the Inspector.
Called by to append the details of this node.
Appends the `parameter` in a viewer-friendly format.
Plays a single on startup.
[]
The component which this script controls.
If you need to set this value at runtime you are likely better off using a proper
.
[]
The which will be played by .
If you need to set this value at runtime you are likely better off using a proper
.
If true, disabling this object will stop and rewind the animation. Otherwise it will simply be paused
and will resume from its current state when it is re-enabled.
The default value is true.
This property wraps and inverts its value.
The value is serialized by the .
It requires Unity 2018.1 or newer.
The being used to play the .
The being used to play the .
Indicates whether the animation is playing (true) or paused (false).
[]
The speed at which the animation is playing (default 1).
Thrown if this component is not yet .
[]
Determines whether Foot IK will be applied to the model (if it is Humanoid).
The developers of Unity have states that they believe it looks better with this enabled, but more often
than not it just makes the legs end up in a slightly different pose to what the animator intended.
Thrown if this component is not yet .
The number of seconds that have passed since the start of the animation.
Thrown if this component is not yet .
The of this state as a portion of the , meaning the
value goes from 0 to 1 as it plays from start to end, regardless of how long that actually takes.
This value will continue increasing after the animation passes the end of its length and it will either
freeze in place or start again from the beginning according to whether it is looping or not.
The fractional part of the value (NormalizedTime % 1) is the percentage (0-1) of progress in the
current loop while the integer part ((int)NormalizedTime) is the number of times the animation has
been looped.
Thrown if this component is not yet .
Indicates whether the is valid.
[Editor-Only]
Called by the Unity Editor when this component is first added (in Edit Mode) and whenever the Reset command
is executed from its context menu.
Tries to find an component on this or its
children or parents (in that order).
[Editor-Only]
Called by the Unity Editor in Edit Mode whenever an instance of this script is loaded or a value is changed
in the Inspector.
Tries to find an component on this or its
parents or children (in that order).
Called by Unity when this component is first created.
Initialises everything needed to play the .
Called by Unity when this component becomes enabled and active.
Plays the on the target .
Called by Unity every frame while this component is enabled and active.
Checks if the animation is done so it can pause the to improve performance.
Called by Unity when this component becomes disabled or inactive.
Ensures that the is properly cleaned up.
Called by Unity when this component is destroyed.
Ensures that the is properly cleaned up.
[Editor-Only]
Ensures that the is destroyed.
[]
Adds the to the list.