N
N
Netrox562022-01-09 22:02:45
Unity
Netrox56, 2022-01-09 22:02:45

How to fix button sound playing during scene transition?

How can I make it so that while the fade animation is playing, the button cannot be pressed, or that during the animation the button sound is no longer emitted after 1 time?

public Image black;
    public Animator sceneTransition;
    public AudioSource buttonSound;


    public void LoadEasyGameScene()
    {
        buttonSound.Play();
        StartCoroutine(Fading());
    }

    IEnumerator Fading()
    {

        sceneTransition.SetTrigger("end");
        yield return new WaitForSeconds(0.99f);
        SceneManager.LoadScene(1);
        PlayerPrefs.SetInt("easy", 1);
        PlayerPrefs.Save();
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2022-01-10
@freeExec

Buttons have a propertyinteractable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question