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

Loading the map while game is paused

Discussion in 'Scripting' started by Cryptocurrency, Sep 27, 2015.

  1. Cryptocurrency

    Cryptocurrency

    Joined:
    Jun 24, 2015
    Posts:
    7
    Hi,

    Im using Unity 5 and recently made a game.

    When you press play in my game, the game starts instantly. Wich now has become a problem when the map is becoming more and more complex. This is causing a big lag when you press the play button. Therefore I have created a short pause when you press play (changing the execution order of that script to start first), and in that pause I would like the load some gameobjects, or parts of the map into the game. How do I do that? What commands are there to load different parts of the game?

    Best regards, Cryptocurrency
     
  2. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    If the game is in another scene from your menu you could use Application.LoadLevelAsync(), unity is going to load in background everything it can.

    You might still have a hickup when everything is loaded if you have lots of initialization going on but you could probably split it up over several frames a little if that's the case.
     
  3. Cryptocurrency

    Cryptocurrency

    Joined:
    Jun 24, 2015
    Posts:
    7
    Thanks for the reply, tried to create a loading scene and it ended up taking alot of time to make it useful enough. I adjusted the graphics settings instead wich worked very well for the moment. But next time I will create loading scene.