I am getting a error on the line "playingAnimation = animInfo[0].clip.name;" but everything seems to be working fine. Any idea on how to stop the error from showing, or if I am doing something wrong.
Code:
void Update()
{
animInfo = animator.GetCurrentAnimatorClipInfo(0);
playingAnimation = animInfo[0].clip.name;
AnimationSet();
animator.CrossFade(targetAnimation, transitionTime, 0);
}
void AnimationSet()
{
transitionTime = 0.05f;
targetAnimation = "Idle";
if(state.isMoving)
{
transitionTime = 0.1f;
targetAnimation = "Walking";
if(state.isRunning) targetAnimation = "Running";
}
}
↧
Why is this throwing an "IndexOutOfRangeException: Index was outside the bounds of the array." error
↧