When I press a UI button I need to trigger an animation followed by changing the scene (after the animation has finished). Both of my sets of code work individually, however I am unsure of how to merge them and to ensure the change of scene doesn’t happen until after the animation has finished. I am new to unity so any help would be useful! Thanks ![]()
This is the code I have at the moment to trigger the animation.
public class LeftButtonPress3 : MonoBehaviour {
public Button Text;
public Animator ani;
public Canvas yourcanvas;
void Start() {
Text = Text.GetComponent<Button>();
ani.enabled = false;
yourcanvas.enabled = true;
}
public void Press() {
Text.enabled = true;
ani.enabled = true;
ani.Play("Fisherman - Left 3");
}
}
This is the code I have at the moment to change the scene.
public class GoToScene1 : MonoBehaviour {
public void ChangeScene(string sceneName) {
SceneManager.LoadScene(sceneName);
}
}