Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question 2D game framerate drop with additionally loaded scenes

Discussion in 'Web' started by patrickk2, Dec 6, 2022.

  1. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hallo everyone!

    I started on a 2D project where a character with respective sprite animations moves on a grid. When everything is in a single scene this works fine and the movement is smooth, but when I split the setup into an initial scene (with some global managers for the game) and a scene with the actual level that is loaded additionally, the framerats drastically drops in the WebGL build (it still runs smoothly in the Unity editor). The code for the pathfinding and movement stays the same, so it seems to have to do with the scene split.

    Are there any WebGL specific points to look out for when making a WebGL build that loads several scenes additionally that could impact the performance?

    Any hints and tipps for this issue would be greatly appreciated.

    Thanks in advance and best regards,
    Patrick
     
  2. NicBischoff

    NicBischoff

    Joined:
    Mar 19, 2014
    Posts:
    204
    Do both scenes have cameras? Also check you don’t have two listeners (on multi cameras) as it creates debug spam. Check the stats and profile to see where the slow down is happening.
     
  3. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hello @NicBischoff!

    Thanks for your tipps! I will look into profiling the build as soon as I can. The camera in the starting scene is deactivated as soon as the additional level is loaded, and there is only one listener present. Could there be anything else causing problems, or is deactivating the camera maybe not enough?

    Best regards,
    Patrick