Forum rules - please read before posting.

Long delay between scene changes

Hi there!

I'm currently using AC 1.57b for developing, and I've found something that gets a little annoying: the loading time between scenes, is really high. My game is basically a 2.5D adventure, normally with little amount of characters per scene (often, just one, the main character). For instance, in my first scene, I have the main character, 10 hotspots, 12 interactions, 1 cutscene, and 9 markers. In certain moment, I switch the scene to another one, that is way simpler: a background, 5 hotspots, 5 interactions and none character. This switch takes about 25 seconds in my macbook pro late 2015 (something that destroys the mood, because this second scene represents just a "close-up" of the first one, a drawer).

Could it be because of the Save System? Several hotspots have "Remember..." components, I guess that could help to increase the saving time. If that's the case, is there a way to disable the automatic saving, so I can decide where to save my scene?

Thanks in advance!

Comments

  • Welcome to the community, @lorenzochomp.

    The number of Remember components shouldn't affect it like that - how many are we talking about, though?  How about the number of Actions and ActionLists?

    If a scene takes a long time to load, it's generally because Unity itself requires it - AC doesn't have much going on beside scripts, while long loads is usually down to graphics, model sizes, etc.

    One way AC can combat this, however, is to preload scenes.  If Asynchronous scene loading? is checked in the Settings Manager, you can use the Scene: Switch Action to just preload a scene.  This will speed up the loading time when you use it to switch scene properly - provided that you know in advance which scene you want to next switch to.
  • Thanks for the welcome, Chris! And for your quick reply, of course :)

    There are only two RememberVisibility components, and while the main actionlist is big (the one in the first scene, it's a cutscene with about 25 actions), the second scene is tiny (no cutscenes, just a couple of interactions).

    I've done this test: instead of using the action "Scene / Switch", I've tried "Object / SendMessage", with a dummy gameobject and a test script. This script has a simple message method, "SwitchScene", that basically does a SceneManager.LoadScene(). With this approach, the loading takes less than a single second! Therefore, there is definitely something more going on here...

    The only thing I see in the console, is a warning: "GameObject OfficeCam was not saved because it does not have a 'Constant ID' script - please exit Play mode and attach one to it." (referring to my main camera). It appears two times, so I don't thing that would be enough to slow down the loading. Anyway, I'll try to do some deep profiling, and I'll post here my results.
  • Thank you, please do.

    While the warning message is likely unrelated, you should follow through with it and attach a Constant ID component to the camera.  Note that this should not be your "MainCamera" object - it should be a camera with one of AC's GameCamera components attached - see the new Manual's Section 4.1 for an overview of how cameras should be arranged in your scene.
  • edited August 2017
    Hi there, @ChrisIceBox! Sorry for my delayed reply, I've been way too busy lately.

    These are my results so far: I've been able to track down the delay to the method Player.LoadPlayerData(), as you can see in this screen capture of a deep profile:
    image
    image

    In particular, the following lines are the main issue (starting at 737, in AC 1.58)
     
    //
     Sound          walkSound
     = AssetLoader.RetrieveAsset (walkSound, playerData.playerWalkSound);
    runSound = AssetLoader.RetrieveAsset (runSound, playerData.playerRunSound);
    // Portrait graphic
    portraitIcon.texture = AssetLoader.RetrieveAsset (portraitIcon.texture, playerData.playerPortraitGraphic);


    If I comment a just one of those resources, the loading time decreases by some noticeable amount. If I comment all three lines altogether, the loading time becomes normal (about a single second, instead of more than 20 in average).

    As far as I can see, there is nothing weird with those assets: two OGG files (less than 8Kb), and a 327x327 PNG (about 400Kb) for the portrait. Any ideas? :)
  • Thanks for the update.  Have a look at bullet point 2 in Section 13.2 of the Manual (Performance and optimisation).

    Give the suggestion it makes a try, even if you don't change those sounds at runtime - it should help make a difference.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.