PlayableOutputRefresher Struct

Summary

A utility for re-assigning Animancer's UnityEngine.Playables.PlayableOutput.
Assembly
Animancer.dll
Namespace
Animancer
Base Types
  • ValueType
graph BT Type-->Base0["ValueType"] Type["PlayableOutputRefresher"] class Type type-node

Syntax

public struct PlayableOutputRefresher : ValueType

Remarks

This should be totally useless, but for some reason it seems to fix an issue with Unity's Animation Rigging package. Normally, all of the Rig's parameters get reset to their starting values any time a playable is connected or disconnected (which Animancer does frequently), but using this utility effectively re-captures the starting values so any subsequent resets retain the values you set.

Example:

public class PlayableOutputRefresherExample : MonoBehaviour
{
    [SerializeField] private AnimancerComponent _Animancer;
    [SerializeField] private Rig _Rig;

    // A field to store it in.
    private PlayableOutputRefresher _OutputRefresher;

    protected virtual void OnEnable()
    {
        // Initialize on startup.
        _OutputRefresher = new(_Animancer);
    }

    public void SetWeight(float weight)
    {
        _Rig.weight = weight;
        
        // Call this after changing something in the rig that would be reset.
        _OutputRefresher.Refresh();
    }
}

Constructors

Name Summary
PlayableOutputRefresher(AnimancerGraph) Creates a new Animancer.PlayableOutputRefresher.
PlayableOutputRefresher(PlayableOutput) Creates a new Animancer.PlayableOutputRefresher.

Properties

Name Value Summary
Output PlayableOutput
The UnityEngine.Playables.PlayableOutput of Animancer's UnityEngine.Playables.PlayableGraph.
Root Playable
The root UnityEngine.Playables.Playable of Animancer's UnityEngine.Playables.PlayableGraph.

Methods

Name Value Summary
OnSourcePlayableChanged() void
Re-acquires the Animancer.PlayableOutputRefresher.Root from the Animancer.PlayableOutputRefresher.Output.
Refresh() void
Re-assigns the Animancer.PlayableOutputRefresher.Root as the source playable of the Animancer.PlayableOutputRefresher.Output.