Playing animations from different layers

I’m attempting to play an animation from different layers but having some difficulty. I’m trying to play animation transitions in one layer and then go back to the base layer to play an animation after the transition is completed. However, the animation in the base layer isn’t playing. Here’s a sample of the code:

 private IEnumerator MyFunc1(Animator animator)
{
  animator.enabled = true;
  animator.SetLayerWeight(7, 1f);
  animator.SetBool("isJumpingFromSitting", true);
  yield return null;
}

StartCoroutine(MyFunc1(Player_animator));

m_Player1.GetComponent<Animator>().enabled = true;
m_Player1.GetComponent<Animator>().SetLayerWeight(0, 1f);
m_Player1.GetComponent<Animator>().Play("Clapping");

Also, we’re unable to play the same transitions, consecutively. That is, after the 1st call to animation transition in another layer, all subsequent calls will not play. It appears that the maybe the parameters are resetting or there maybe some interference with the layer? Could these two (2) issues be related and if so, how can be resolved?

Lastly, attached are 2 screenshots of the sample layers in the Animator Controller.


Are you talking about transitions from code or the graph? Animator.Play() by default won’t transition to itself if it’s already playing unless you use the overload where you specify normalizedTime as 0 so it knows to transition to itself (same with CrossFade).

If your question is about something else, then I might need a screenshot of your setup and a more concrete example of what you’re trying to accomplish because I wasn’t quite able to follow your post.

Hi @clownhunter,

Thanks for the reply. It’s appreciated. I’ve updated the post with some sample code. Hopefully, this will help explain better what we’re attempting to do.

it doesn’t. then you have these screenshots with the graph zoomed out as max as you could so we can’t see nothing.

What don’t you understand from the sample code? And what’s needed to be seen in the Animator Controller, which clearly shows the animation transition and different layers?

I don’t know. I was just trying to help you find the issue you have. having information from your setup would help identifying something you may have missed.

good luck

I think I’ll pass on your “help”. I thought this forum was for those “behind the tech”? Not for trolls.

asking you to post better pictures is trolling. lol

wait for someone else to help you now, i’m out

I asked why you took issue with the sample code and replied dismissively, that you didn’t know. I think that qualifies as troll behavior. Comments made with no intent of edifying, make them neither helpful nor worth reading. So, what you call “help”, I don’t want nor need. In fact, I would like anyone with your type of intent to stay out of the comments. Your condescension and throw-away comments diminishes the intent of this forum.

We were able to resolve the issue of not being able to play animations from different layers by syncing the animation transition or layers w/ the Base Layer (see attached screenshot). However, the animation transitions now play too fast. We’ve tried slowing down the speed of the animation clips in each transition but to no avail. Also, tried Addictive Blending, so that the speed settings would not be overridden and that didn’t work, either.

Help is appreciated.