I’ve been considering jumping to multi scene loading in unity for a while, and I finally decided to take the first steps and move my core logic into another scene. Hopefully these little tips will help someone in the future.

The reason behind this move is that our engine (Unity Adventure Framework) was meant to be reusable among projects but we kept running intro troubles if we decided to update a core feature in let’s say Game C and later decide to get back to Game A.

I have to decide between two options: Have each game with a unique version of the engine or move the core to a reusable scene which will be shared among each game.

So the latter option was chosen and the journey begins.

This will be the easiest and simpler “split: We would only have two scenes for now. The Engine Scene (Aka CORE) and the Game Scene.

What To Move?

In our case it was pretty easy except for one thing I’ll talk about later.

Every “manager” script should be moved to this new core Scene. Game Manager, Camera Manager, Save System, Audio Manager, etc, are great candidates.

What we want on our CORE are our reusable logic mostly.

 2017-11-13 23_20_37-Start.jpg

Special mention for UI

I want a single reusable UI controller, but we most probably will want to add changes to textures, colours etc among each game. The ghost of cross reference appears again: We wont be able to “map” Game scene textures to Core Logic, so instead we will be extending our UI manager to be theme-able. More on this in following posts.

In general this part was fairly easy, I was already (ab)using singletons so I didn’t get too many cross references problems as long as I pay attention to…

Scene Order and programmatically loading scenes.

This one I didn’t pay attention at first, but it brought problems only in build mode.

In short, when you add Scenes additive in the Editor it doesn’t necessarily mean it will add them on the build too (took me longer than I’m proud to admit to realize this).

To overcome this we simply need a new Manager to handle loading all the needed scenes.

We just set what scenes to add to the build, and then the Scene Manager will take care of loading one by one (in the build order) after the CORE scene has been loaded.

2017-11-14 00_00_17-Start.jpg

using UnityEngine;
using UnityEngine.SceneManagement;
namespace UAE
    public class SceneLauncher : MonoBehaviour
        // Use this for initialization
        void Awake()
            //if (!Application.isEditor)
            int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings;
            if (sceneCount > 1)
                for (int i = 1; i < sceneCount; i++)
                    SceneManager.LoadScene(i, LoadSceneMode.Additive);
                    Debug.Log("Loaded Scene: " + SceneUtility.GetScenePathByBuildIndex(i));


What to NOT move?

This one is pretty easy, everything that needs to be personalized should be on the game Scene: Player, game defaults, rooms, actors, interactive objects, quests, etc.

2017-11-13 23_57_49-Start.jpg

Other Problems

I was using File.IO to read some text files instead of TextAassets for some reason. It wouldn’t work. Instead of trying to fix that, I just modified our parser to accept text assets (which I prefer btw)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: