IUpdatable Interface

Summary

[Pro-Only] An object that can be updated during Animancer's animation updates.
graph BT Type["IUpdatable"] class Type type-node Implementing0["LinearMixerState"]-.->Type click Implementing0 "/animancer/api/Animancer/LinearMixerState" Implementing1["MixerState<TParameter>"]-.->Type click Implementing1 "/animancer/api/Animancer/MixerState_1" Implementing2["DontAllowFade"]-.->Type click Implementing2 "/animancer/api/Animancer/DontAllowFade" Implementing3["Updatable"]-.->Type click Implementing3 "/animancer/api/Animancer/Updatable" Implementing4["SmoothedFloatParameter"]-.->Type click Implementing4 "/animancer/api/Animancer/SmoothedFloatParameter" Implementing5["WeightedMaskLayers.Fade"]-.->Type click Implementing5 "/animancer/api/Animancer/Fade" Implementing6["ControllerState"]-.->Type click Implementing6 "/animancer/api/Animancer/ControllerState" Implementing7["FadeGroup"]-.->Type click Implementing7 "/animancer/api/Animancer/FadeGroup" Implementing8["CartesianMixerState"]-.->Type click Implementing8 "/animancer/api/Animancer/CartesianMixerState" Implementing9["ExitEvent"]-.->Type click Implementing9 "/animancer/api/Animancer/ExitEvent" Implementing10["DirectionalMixerState"]-.->Type click Implementing10 "/animancer/api/Animancer/DirectionalMixerState" Implementing11["ManualMixerState"]-.->Type click Implementing11 "/animancer/api/Animancer/ManualMixerState" Implementing12["Vector2MixerState"]-.->Type click Implementing12 "/animancer/api/Animancer/Vector2MixerState"

Syntax

public interface IUpdatable

Remarks

Example: Register to receive updates using Animancer.AnimancerGraph.RequirePreUpdate(Animancer.IUpdatable) or Animancer.AnimancerGraph.RequirePostUpdate(Animancer.IUpdatable) and stop receiving updates using Animancer.AnimancerGraph.CancelPreUpdate(Animancer.IUpdatable) or Animancer.AnimancerGraph.CancelPostUpdate(Animancer.IUpdatable).

 public sealed class MyUpdatable : IUpdatable
 {
     // Implement IUpdatable.
     // You can avoid this by inheriting from Updatable instead.
     private int _Index = IUpdatable.List.NotInList;
     ref int IUpdatable.ListIndex => ref _Index;
     
     private AnimancerComponent _Animancer;

     public void StartUpdating(AnimancerComponent animancer)
     {
         _Animancer = animancer;
         
         // If you want Update to be called before the playables get updated.
         _Animancer.Graph.RequirePreUpdate(this);
         
         // If you want Update to be called after the playables get updated.
         _Animancer.Graph.RequirePostUpdate(this);
     }

     public void StopUpdating()
     {
         // If you used RequirePreUpdate.
         _Animancer.Graph.CancelPreUpdate(this);
         
         // If you used RequirePostUpdate.
         _Animancer.Graph.CancelPostUpdate(this);
     }

     void IUpdatable.Update()
     {
         // Called during every animation update.
         
         // AnimancerGraph.Current can be used to access the system it is being updated by.
     }
 }

Properties

Name Value Summary
UpdatableIndex int
The index of this object in its Animancer.IndexedList`2.

Methods

Name Value Summary
Update() void
Updates this object.

Extension Methods

Name Value Summary
IsInList() bool
Is the `updatable` currently in a list?