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 UnityEngine.Playables.Playable gets connected or disconnected, but using this utility effectively re-captures the starting values so any subsequent resets retain the values you set.

Example: Simply make a new Animancer.PlayableOutputRefresher on startup then call its Animancer.PlayableOutputRefresher.Refresh method after changing any parameter in the Rig or its constraints.
public class PlayableOutputRefresherExample : MonoBehaviour
{
    [SerializeField] private AnimancerComponent _Animancer;
    [SerializeField] private Rig _Rig;

    private PlayableOutputRefresher _OutputRefresher;

    protected virtual void OnEnable()
    {
        _OutputRefresher = new(_Animancer);
    }

    public void SetWeight(float weight)
    {
        _Rig.weight = weight;
        _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.