Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

When switching scene's the very first input is always ignored.

Discussion in 'Editor & General Support' started by Xikini, May 1, 2021.

  1. Xikini

    Xikini

    Joined:
    Feb 5, 2021
    Posts:
    4
    New to Unity.

    I'm transitioning from my start menu into the game, and the first input from mouse and keyboard is always ignored.

    If I load the scene directly, instead of through the start menu, there is no issue.

    So that leads me to believe that something in my start menu setup is screwing up.

    I have the this my Hierarchy

    Untitled.png

    and I have the 'MainMenu' attached to the canvas.

    Untitled.png

    and I'm loading the scene using this

    Code (CSharp):
    1.     public void Load_Grassland()
    2.     {
    3.         SceneManager.LoadScene(1);
    4.     }
    It all seems fairly basic to me, but I guess I've missed a step somewhere.

    Googled around for awhile, and couldn't find anyone else with the issue, so posting here and hoping for the best. xD

    Anyone have a clue why the first input is failing?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    Xikini likes this.
  3. Xikini

    Xikini

    Joined:
    Feb 5, 2021
    Posts:
    4
    I found a solution using your comment as a guidepost.

    Code (CSharp):
    1. SceneManager.LoadScene(1, LoadSceneMode.Single);
    Adding the load scene mode single, seems to completely erase the main menu from existence, instead of layering on top.

    I think the issue is/was that the mouse event triggered on the down press, and something about the button was still selected, and since it was still in the background, you needed to push any key to get out of that state.

    Anyway, that's just my guess!

    The above addition worked perfectly and removed the issue.

    Thanks for the help!
     
    Kurt-Dekker likes this.