So using what I found on my other question, I wrote this code:
private void Die()
{
Animator.updateMode = AnimatorUpdateMode.UnscaledTime;
EllaAnimator.updateMode = AnimatorUpdateMode.UnscaledTime;
for (int i = 0; i < Mathf.CeilToInt(LastRemainedHearts / 2f); i++)
{
ParentMiddleBelt.transform.GetChild(i).GetChild(1).GetComponent<Animator>().updateMode = AnimatorUpdateMode.UnscaledTime;
ParentMiddleBelt.transform.GetChild(i).GetChild(1).GetComponent<Animator>().enabled = true;
}
Time.timeScale = 0;
EllaAnimator.SetInteger("RunTo", 8);
EllaAnimator.SetInteger("PushToward", 5);
EllaAnimator.SetBool("Death", true);
}
as you can see, there are three animators which I'm trying to change their update mode:
- Animator: the animator on this object
- EllaAnimator: the player's animator
- ParentMiddleBelt.transform.GetChild(i).GetChild(1).GetComponent(): the animator attached to "health bullet"s (see the pictures below)
Animator and EllaAnimator run perfectly fine but for some reason, the third one doesn't.
I used print()
and inspector to see if the UpdateMode is being changed or not and as it turned out, it does change. So my problem is that regarding UpdateMode being set to unscaled time, why it still doesn't play?
side note: ParentMiddleBelt
is an empty game object that stores clones of belt(middle) prefab