public override void ProcessFrame(Playable playable, FrameData info, object playerData) { int inputCount = playable.GetInputCount(); string stateName = ""; AnimatorPlayableBehaviour behaviour = null; int index = findActiveIndex(playable, lastIndex_); if (index == -1) { return; } if (lastIndex_ == index) { return; } lastIndex_ = index; var inputPlayable = (ScriptPlayable <AnimatorPlayableBehaviour>)playable.GetInput(index); var input = inputPlayable.GetBehaviour(); stateName = input.stateName; behaviour = input; if (string.IsNullOrEmpty(stateName)) { return; } // 反映 var binding = playerData as Animator; if (binding != null) { binding.Play(stateName, 0, 0f); } }
// Factory method that generates a playable based on this asset public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { var bh = new AnimatorPlayableBehaviour(); bh.stateName = stateName; var playable = ScriptPlayable <AnimatorPlayableBehaviour> .Create(graph, bh); return(playable); }