Button Calling Animation, but also change Scene after some clicks

Hello! I am new in Unity, maybe 2 weeks. before we begin I apologize for my bad English.

so, I made a CPR tutorial with some animation. I put a button in the middle of the chest image (so it will trigger CPR animation, you cant trigger it by clicking on the head).

here is the problem. I already called CPR animation, and it back into the previous scene. (as I hoped.) I want after 30x click, we move into a completely new scene. so I put 2nd script in my button (1 script for navigating to CPR animation earlier) but it didn’t work. if I use this script in a completely new button, it work. can someone explain where I did it wrong? thanks for the time.

When you switch to a new scene everything is reset to its original state in that scene. Think about if you really need to switch to a new scene, maybe you can do it by just changing something in a script. I haven’t worked with animations so I don’t know about that but I still think you shouldn’t change the scene if most of it is the same in the new scene. What was it that didn’t work?

I got this problem solved a few weeks ago. So here’s what I did.

  1. I made 1 animation in a scene, and put a button on top of it.
  2. this animation has an animation and animator menu, let’s note it first
  3. I made a counter++ script (for counting button click, ex: if counter>=15 so after 15 clicks it will change scene). this solved first problem, where we can move into next scene after some amount of clicks.
  4. for 2nd problem, I drag 2nd animation (which played when the button clicked) to 1st animation animator windows. here I put trigger, when animation 1 played (loop) and the trigger is on (which I connected with button) it will play 2nd animation, for once. and then back to 1st animation.
  5. Thank God I managed to finish this problem.