Skip to main content

VrMainMenu

A class in Root.Township, the global namespace.

Controller for the VR main menu scene (singleton Instance): starts a local test or joins a server picked from the server list. Client only.

Constructors​

MemberWhat it is
VrMainMenu()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private LocalNetworkScene localSceneThe menu's local network scene, emptied by PrepareForUnload.
private static Logger loggerLogger for this class.
private ServerSelectionMenu serverSelectionThe server list menu, paused while a game starts.
private Task startingGameTaskThe game start in progress, used to block a second start.
private bool startLocalTestInspector button for StartLocalTest.

Methods​

MemberWhat it is
void JoinServer(GameServerInfo serverInfo)Joins the given game server through GameModeManager, unless a start is already running. Called by the server list.
void PrepareForUnload()Destroys the menu scene's local entities and clears IsLocalTest. Called by AltaSceneManager.
void StartLocalTest()Starts a local test game through GameModeManager.StartLocalTest, unless a start is already running.
static async Task TakeMemorySnapShot()Cleans memory, then saves a Unity memory profiler snapshot in the persistent data folder.
5 private and internal methods
MemberWhat it is
private static void FinishedSnapshot(string arg1, bool arg2)Logs when a memory snapshot is done.
private static void LowMemory()Logs a low memory warning and runs ApplicationManager.CleanMemory.
private void OnValidate()Editor: starts a local test when the startLocalTest button is pressed.
private void Start()Sets the main menu logger and marks the scene as a local test.
private async Task StartGameAsync(Func<Task<bool>> startGameMode)Fades to black and runs the start function. On failure fades back in, resumes the server list and goes back to local test mode.