Preloading a Scene or Overlay

Playing a scene or overlay can sometimes a little while to load depending on the number of objects or behaviours. With preloading, you can make loading a scene or overlay feel instantaneous by loading when your player doesn't notice. There are two ways to preload a scene: before your project starts from scene settings, or asynchronously (while your scene is already running) using behaviours.

 

Preloading from Scene Settings

You can tell your project to preload scenes or overlays that you know the player is going to be using frequently. To do this open the Project Settings and tap on the gear icon

 

press settings

 

and toggle on Preload.

 

 

If your scene has a lot of objects and behaviors, it may not be a good idea to preload from the beginning. Preloading many scenes and overlays can affect performance and it may be better to preload as your player goes along.

 

Preloading Asynchronously Using Behaviors

When you don't want to affect performance by preloading all your scenes, it sometimes makes sense to preload a scene or overlay asynchronously.

An example of when to use asynchronous preloading could be a game where the player is reaching near the end of the level. You want to get the next level ready so that when the player does reach the end, the next level loads instantly.

 

To preload asynchronously, simply add the Preload Scene behavior, found in Advanced Scene behaviors, when an event is triggered.

 

Then select the scene or overlay that you want to preload.

When the scene is finished preloading, it triggers an event. So you can do something like enable a button when the scene is done loading.

 

When you're done with a preloaded scene, make sure you use the Unload Scene behavior to make sure you don't affect the performance of your project.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk