Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Game Crashes when Mouse Clicked while Loading Scene

Discussion in 'Scripting' started by Nosada, Dec 4, 2020.

  1. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
    My game crashes when the mouse is clicked while a scene is loading. I am using SceneManger.LoadScene() in my script to load. This happens in the build, not in the editor. Does anyone know why this happens and how I can stop it?
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,888
    Do you have any scripts that respond to mouse clicks?
     
  3. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
    Yes but I have two separate ways to prevent player input on the loading screens. The left mouse button and the left ctrl button do the same thing, and the game doesn't crash if you hit the left ctrl on the loading screen, but it does when you click the mouse.
     
  4. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,888
    From the description you've given, I'm not sure what the problem is. First thing to check would be any error or crash logs that the game produces.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
  6. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    You could speculate that your issue is related to something that happened to a stranger in 2016 using a different API (Application.LoadX() vs Scene Manager)

    Who knows, you might get lucky!

    OR... you could initiate standard steps as outlined in the above post.

    To get started, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

    Doing this should help you answer these types of questions:

    - is this code even running? which parts are running? how often does it run?
    - what are the values of the variables involved? Are they initialized?

    Knowing this information will help you reason about the behavior you are seeing.
     
  8. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
    I have to admit I'm not well-versed in checking the logs; is this the Editor text file found in the Unity folders under AppData?
     
  9. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    Console window, accessible under the Windows menu pulldown.
     
  10. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
    I can't think of a non-vague way to say this, but I've already tried many of the basic debugging steps. The game is fully functional; this is one of the only issues that remain after a lot of testing. I don't think it's an issue with any thing that I wrote; I think it's an issue outside of my work, if that makes sense.
     
  11. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
    I'm talking about a standalone build not in the editor.
     
  12. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
  13. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,888
    Look for the player logs. This page can help you find them: https://docs.unity3d.com/Manual/LogFiles.html
     
  14. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    An easy thing to check is just disable all mouse scripts, then try to reproduce the issue. If it reproduces, the issue has nothing to do with your mouse scripts. If it doesn't reproduce, then you should look closer at your mouse script. Extremely simple test to narrow this down quickly. Otherwise everything is just wild speculation.
     
  15. Nosada

    Nosada

    Joined:
    Aug 6, 2013
    Posts:
    69
    When I look in the folder for Player.log, there isn't a file there called Player.log; there is a text document there called output_log. I assume this is what I'm looking for. I open the file but I don't know what to make of it or what I should be looking for. I don't see any indications of an error but I'm not sure what else is relevant there.