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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Game freezes when loading new scene when spamming mouseclick

Discussion in 'Editor & General Support' started by lowbl_dan, Nov 13, 2020.

  1. lowbl_dan

    lowbl_dan

    Joined:
    Jan 22, 2019
    Posts:
    34
    Currently I have a huge scene that uses an LoadSceneAsync to load in the new scene while a loading page is displayed. Spamming mouseclick causes the unresponsive window to pop up, so I also disabled EventSystem
    to disable mouse receive events but that did not help. The scene will successfully load if I don't spam mouseclick. The huge scene generally contains multiple static .fbx terrains and a lot of UI.

    Build settings
    - FullscreenMode: Fullscreen window
    - Unity version 2019.4.10f1

    I have referred to other threads such as
    https://forum.unity.com/threads/freeze-problem-while-scene-changes.477020/

    I believe that I am loading in many resources at once, so I have tried the following methods but it still seems to freeze.

    1) Dynamically loading in some of the other terrains with Addressables because I'm consider a use-case where the .fbx needs to be updated in a patch in the future. The objects are not set to static on creation, which is an issue.
    2) Splitting up the terrains into another scene and them progressively with LoadSceneAsync additive mode.

    I hope people can share on best practices to loading huge scenes, there seems to be many resources on loading huge scenes, but I am unsure if addressable or additive scenes is the better way to work around this issue.

    Thanks for reading.
     
    Last edited: Nov 13, 2020
  2. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    Have you tried just waiting for some time to see if Unity becomes responsive again?

    When that unresponsive window comes up, it just means that the software has not told windows that it is still alive for a while. This happens when software freezes, but can also happen when software does some large time consuming computation in the main thread.

    If it is truly freezing, try connecting Visual Studio to it and pausing execution to see where it is getting stuck.
     
    lowbl_dan likes this.
  3. lowbl_dan

    lowbl_dan

    Joined:
    Jan 22, 2019
    Posts:
    34
    Hi bob, Thanks for your suggestion! , I was able to pick up that the freeze was caused by many simultaneous coroutines running on scene load instead by attaching the profiler to the executable.