Search Unity

Game taking forever to load on second play

Discussion in 'Scripting' started by MrZeker, Jun 8, 2019.

  1. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    Hello, i have a problem, and i need any help i can get.
    Im making a game, and im having a problem, whenever the game loads it takes 10-20 seconds to load, however, if i end the game, and start again, the game takes around 2+ minutes to load, the same scene, with the same EVERYTHING.

    Now, the worst part is that i can not reproduce this bug, in my computer it loads perfectly every time, but three different people so far told me they had the same problem.
    im playing from a SSD , and one of the players told me he has a HDD. maybe that can be?

    what can be the possibilities that cause this? i know its very hard withouth looking at the code.
    from what i read on google it may be caused by using static variables, but im setting them to null once the game finished, so they can get refreshed when the game starts again.

    Any suggestions?
    im completely blind here, since i can't reproduce that bug myself for testing.
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Is it something related to save files or anything like that? What sort of processing would you be doing on the second execution of the game? You'll also want to do some reading on the profiler, even if it's not consistently happening on your machine, and see what methods are slow (which are compounded on lower spec machines).
     
  3. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    im gonna try that!
    i dont really have a save system yet, so it is only loading the selected character's stats from Scriptable objects.