This page covers the various managers included in the TopDown Engine and how to tweak them to your needs.


The TopDown Engine uses managers as central reference points for a lot of classes and components. These managers, always present in your scene, will remember the current points count, the sounds that are playing, or where to spawn the character.

There are a few of them, and in most scenes you’ll have a Game, Level, Input, Time and Sound managers present at all time. Usually you’ll want to place them on empty gameobjects. Their position in your scene doesn’t matter, they’re invisible anyway. It’s good practice to put them out of the way of your level so you don’t delete them by accident.

Game Manager

The Game Manager is a high level manager that is responsible for setting the target frame rate, the game loop, storing the points or handling the timescale. It can also optionnally handle the lives system, defining how many lives the player can have, and how many it has right now. In this case you’ll have to specify a game over screen to redirect the player to in case all lives are lost. In most cases you won’t have to interact with it, but make sure there’s one in your levels. The API documentation is a good place to go to if you want more information about it.

Level Manager

The Level Manager is a reference point for a lot of the engine’s scripts. It maintains a list of player characters in the game (usually one but you could have more if you want). It’s also in charge of spawn and respawn, and checkpoint management.

The LevelManager's inspector from the Loft demo scene
The LevelManager's inspector from the Loft demo scene

In most cases you’ll want a LevelManager in each of your levels. It needs to be on its own gameobject. From its inspector you can (and should) set what prefab to use as the player. To do so, unfold the PlayerPrefabs dropdown if it’s folded, and just drag a prefab from your project view into the Element0 field. For more information about the “Auto Attribute Player ID” checkbox, check out the Input page.

Note that the LevelManager also lets you have Player Characters already in the scene. In this case, simply empty the PlayerPrefabs list, and drag your Character(s) from the scene into the SceneCharacters array instead.

You can add a BoxCollider to your LevelManager, which will then automatically act as constraining bounds for your Camera, as long as it’s got a CinemachineCameraController on its virtual camera.

From the inspector you’ll also be able to specify delays (before the death screen appears, before respawn…) as well as fade settings for fading the whole screen in and out.

Input Manager

The Input Manager handles the inputs and sends commands to the player. It’s described in more details on the Input page.

:warning: This script’s Execution Order MUST be -100, to make sure it always runs first on each Update(), and avoid weird side effects, especially at low framerates. If you’ve imported the engine into a blank project that should already be the case. You can define a script’s execution order by clicking on the script’s file and then clicking on the Execution Order button at the bottom right of the script’s inspector. See this page for more details.

Sound Manager

As its name implies, the Sound Manager is in charge of playing sounds in the TopDown Engine. Of course you can play them directly in your code using Unity’s native APIs, but using the Sound Manager will ensure that it’s played using the same volume settings as other sounds, that they won’t be played if sound has been disabled, etc. It’s usually found on the same prefab as the GameManager script. From its inspector (or from your code), you’ll be able to set the music and sound effects (Sfx) volume, and whether or not each is active. You can have a look at the API documentation for details, but mostly you’ll be using the following methods :

To play a background music (will replace any previously playing background music) :

PlayBackgroundMusic(AudioSource Music);

To play a sound effect - you can specify its position in space, and whether or not it should loop (make sure you stop it in this case) :

PlaySound(AudioClip sfx, Vector3 location, bool loop=false);

Loading Scene Manager

With Unity, usually when you want to go to another scene (in a menu, or to go from one level to the next for example), you’d use the SceneManager API, and probably the SceneManager.LoadScene() method. Personnally I think that this method doesn’t provide visual feedback to the player, and scene loading on mobile for example can be a few seconds long, so just having a black screen there isn’t really good looking. The engine comes with its own scene change API, that you’re completely free not to use if you don’t like it.

The LoadingScene in scene view
The LoadingScene in scene view

If you want to provide a better experience to your player, you can use the Loading Scene Manager :

  • it can be called from anywhere, you don’t have to have a LoadingSceneManager in your scene
  • it handles loading (as the name implies), showing an animation and a progress bar
  • it’s completely customizable, just edit the Common/LoadingScene scene’s contents. You can easily add your own logo, change the look of the progress bar, what animation is playing, etc.
  • it’s pretty simple to use

To use the LoadingSceneManager API, when you want to change level, just call the LoadingSceneManager.LoadScene (string sceneToLoad) method. The string parameter you pass must of course match the name of the scene you’re trying to load. So if you were to load the Koala Dungeon level for example, you’d use :

LoadingSceneManager.LoadScene ("KoalaDungeon");

And the engine will take care of the rest :rocket:

Extending a manager

If for some reason you want to modify a manager’s behaviour, the best way to do so is to extend it. That way, you won’t lose your changes if you update the asset. Extending a manager is fairly easy. All you have to do is create a new class, that inherits from the manager whose behaviour you want to change, like so :

using UnityEngine;
using System.Collections;
using MoreMountains.Tools;
using System.Collections.Generic;

namespace MoreMountains.TopDownEngine
	public class NewGameManager : GameManager
		protected override void Start()
			MMDebug.DebugLogTime("new game manager");

		public override void Pause()
			MMDebug.DebugLogTime("new game manager pause");

		public override void AddPoints(int pointsToAdd)
			MMDebug.DebugLogTime("new game manager add points");

In this example, a new GameManager is created, and a few of its methods are overridden. They don’t do much, they just do what the base class does, and then output a debug message. Of course, you could have them do much more. All you have to do then is to place that new manager in your scene on an object, and remove the base one.