Search Unity

[solved] scene change takes a lot of time

Discussion in 'Multiplayer' started by Obstbaum13, Mar 1, 2018.

  1. Obstbaum13

    Obstbaum13

    Joined:
    Oct 17, 2017
    Posts:
    2
    I am currently developing a multiplayer experience game with a custom network manager in unity 2017.3. I have different levels so I need to change the scenes. But there occurs the problem that the change itself takes a really long time (up to 1 minute).
    In the hierarchy there is a bunch of entries named "scenename (is loading)" (see attached image). Every item loads about 5 to 10 seconds and then dissappears from the list. After all items have been loaded the new scene starts.

    What might be the cause for the duration of the scene change and why is there more than one "is loading" entry?

    Any help would be appreciated!
     

    Attached Files:

  2. j0k0

    j0k0

    Joined:
    Dec 14, 2016
    Posts:
    1
    This might happen, when you trigger the scene change in the Update() routine of a script and don't uncheck the trigger condition. Since the preparation of the scene change takes several frames, the method ServerChangeScene() will be triggered multiple times. What you see in your editor screenshot is Unity's attempt to load the scene over and over again.
    So you either should take the scene change out of the Update or check if your scene change has already been initiated and assure that it is only called once.
     
  3. Obstbaum13

    Obstbaum13

    Joined:
    Oct 17, 2017
    Posts:
    2
    Thanks a lot for your help.