I have a script that I have connected to a button in Unity that switches the scene, but I also have an animation I want to play after the button is pressed. The button starts that animation, but you can't see the animation because the scene switches too quickly.
I've tried using coroutine and timers, but I don't have the technical know how to fully implement them.
I would prefer using a coroutine if that's possible. My code is:
public void LoadNextScene()
{
int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(currentSceneIndex + 1);
}
public void LoadMenuScene()
{
SceneManager.LoadScene(0);
}
}
I want the button to be pressed, then the animation played, and finally the scene switches. Could you please recommend the required code changes to achieve my desire?