private StateInfo DoAddClip(string name, AnimationClip clip) { //Start new State StateInfo newState = m_States.InsertState(); newState.Initialize(name, clip, clip.wrapMode); //Find at which input the state will be connected int index = newState.index; //Increase input count if needed if (index == m_Mixer.GetInputCount()) { m_Mixer.SetInputCount(index + 1); } var clipPlayable = AnimationClipPlayable.Create(graph, clip); clipPlayable.SetApplyFootIK(false); clipPlayable.SetApplyPlayableIK(false); if (!clip.isLooping || newState.wrapMode == WrapMode.Once) { clipPlayable.SetDuration(clip.length); } newState.SetPlayable(clipPlayable); newState.Pause(); if (keepStoppedPlayablesConnected) { ConnectInput(newState.index); } return(newState); }
private StateInfo DoAddClip(string name, AnimationClip clip) { //Start new State StateInfo newState = m_States.InsertState(); newState.stateName = name; newState.clip = clip; newState.wrapMode = clip.wrapMode; //Find at which input the state will be connected int index = newState.index; //Increase input count if needed if (index == m_Mixer.GetInputCount()) { m_Mixer.SetInputCount(index + 1); } newState.playable = AnimationClipPlayable.Create(graph, clip); if (!clip.isLooping || newState.wrapMode == WrapMode.Once) { newState.playable.SetDuration(clip.length); newState.playable.SetPlayState(PlayState.Paused); } if (keepStoppedPlayablesConnected) { ConnectInput(newState.index); } return(newState); }