Skip to content

Commit f65b84b

Browse files
committed
Use index instead of raw playable for perf
1 parent 5ef5097 commit f65b84b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

org.mixedrealitytoolkit.uxcore/StateVisualizer/StateVisualizer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,16 +720,17 @@ private bool EvaluateEffects()
720720
private bool UpdateWeight(IAnimationMixableEffect mixableEffect, State state)
721721
{
722722
bool done = true;
723+
int inputIndex = mixableIndices[mixableEffect];
723724

724725
if (mixableEffect.WeightMode == WeightType.MatchStateValue)
725726
{
726727
// Set the playable's weight directly to the state's value.
727-
animationMixerPlayable.SetInputWeight(mixableEffect.Playable, state.Value);
728+
animationMixerPlayable.SetInputWeight(inputIndex, state.Value);
728729
}
729730
else if (mixableEffect.WeightMode == WeightType.Transition)
730731
{
731732
// Grab the current weight, using our cached mixable indices.
732-
float currentWeight = animationMixerPlayable.GetInputWeight(mixableIndices[mixableEffect]);
733+
float currentWeight = animationMixerPlayable.GetInputWeight(inputIndex);
733734

734735
// Compute the direction of the transition.
735736
bool shouldBeActive = !Mathf.Approximately(state.Value, 0.0f);
@@ -748,7 +749,7 @@ private bool UpdateWeight(IAnimationMixableEffect mixableEffect, State state)
748749
else
749750
{
750751
// WeightType.Constant is the only remaining option; the weight is always 1.0.
751-
animationMixerPlayable.SetInputWeight(mixableEffect.Playable, 1.0f);
752+
animationMixerPlayable.SetInputWeight(inputIndex, 1.0f);
752753
}
753754

754755
return done;

0 commit comments

Comments
 (0)