During the development on 用 TimeLine 來實作跳越障礙物, I discover the Animator will be uninitialized.
waiting the answer on Forum, but the solution I made up was manually re-initialize all private reference and avoid keeping the long term reference on SMB,
here is the sample code to detect Animator become uninitialized.
private bool m_AnimationDirty = false;
private void Update()
{
if (!m_AnimationDirty && !animator.isInitialized)
{
m_AnimationDirty = true;
Debug.LogWarning("Animator dirty", animator);
}
else if (m_AnimationDirty && animator.isInitialized)
{
m_AnimationDirty = false;
ReInitSMB(); // reinitialize reference right here.
Debug.Log("Animator Re-init SMB reference.", animator);
}
}