Skip to content

Instantly share code, notes, and snippets.

@SiunCyclone
Last active June 1, 2020 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiunCyclone/a01cc12e076c75d9706f6dd6fa3bbd46 to your computer and use it in GitHub Desktop.
Save SiunCyclone/a01cc12e076c75d9706f6dd6fa3bbd46 to your computer and use it in GitHub Desktop.
public void Initialize(EntityManager entityManager, Entity owner, Entity character) {
m_Animator = entityManager.GetComponentObject<Animator>(owner);
m_Animator.fireEvents = fireAnimationEvents;
m_PlayableGraph = PlayableGraph.Create(name);
m_animGraph = animStateDefinition.Instatiate(entityManager, owner, m_PlayableGraph, character);
m_animGraphLogic = m_animGraph as IGraphLogic;
m_PlayableGraph.Play();
var outputPlayable = Playable.Null;
var outputPort = 0;
m_animGraph.GetPlayableOutput(0, ref outputPlayable, ref outputPort);
// Set graph output
var animationOutput = AnimationPlayableOutput.Create(m_PlayableGraph, "Animator", m_Animator);
animationOutput.SetSourcePlayable(outputPlayable);
animationOutput.SetSourceOutputPort(outputPort);
}
IAnimGraphInstance m_animGraph;
IGraphLogic m_animGraphLogic;
Animator m_Animator;
PlayableGraph m_PlayableGraph;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment