ApplicationManager
A class in Root.Township, the global namespace.
Singleton that handles app start, pause, reload and shutdown, and tells you whether this is a headless (server) build. Both sides.
- Listed in Global namespace: A to B
- Inherits or implements
SingletonBehaviour<ApplicationManager> - Derived types
ApplicationManager - Documented in Startup and app state
Constructors
| Member | What it is |
|---|---|
ApplicationManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
static bool IsApplicationPaused | Whether the app is paused right now. |
static bool ShouldRestartAfterShutdown | When true, the server heartbeat isn't shut down on quit. |
8 private and internal fields
| Member | What it is |
|---|---|
private static bool hasQuit | True once OnApplicationQuit has run, so it only runs once. |
private static bool isCleaning | True while CleanMemory is running, so calls don't overlap. |
private static bool isHeadless | Cached result of IsHeadless. |
private static bool isQuit | True once Update has triggered the quit after an external shutdown request. |
private static Logger logger | NLog logger for this class. |
private static bool needsToCache | True until IsHeadless has checked the command line for -batchmode or -nographics. |
private IServerHostController serverHostController | Injected IServerHostController. Set by Inject but not used in this file. |
private static ShutdownReason shutdownReason | Reason passed to ExternalOnApplicationQuit, given to GameModeManager.StopCurrentModeAsync on quit. |
Properties
Events
Methods
| Member | What it is |
|---|---|
static async Task CleanMemory() | Unloads unused assets and runs a full garbage collection. Skipped if a clean is already running. |
static void ExternalOnApplicationQuit(ShutdownReason reason) | Asks for a shutdown with a reason. The actual shutdown runs on the next Update. |
static string FilteredCommandLine() | The process command line with access, refresh and identity tokens and /login details masked out. |
static void FinishReload() | Clears IsReloading. |
void OnApplicationQuit() | Shuts down once: stops the game mode, stops the heartbeat unless restarting, saves preferences, runs ApplicationQuit, finishes file writes and quits. |
static void StartReload() | Starts a scene reload and raises GameReload, unless already reloading or quitting. |
protected void Inject(IServerHostController injectedServerHostController) | Receives the server host controller through dependency injection. |