Skip to main content

MenuSettings

A class in Root.Township, the global namespace.

Global settings asset for the menu and startup: scene names, server list colours and materials, selection orb tuning and editor-only startup flags. Get it with GlobalSettings<MenuSettings>.Instance.

Constructors​

MemberWhat it is
MenuSettings()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
int bundleVersionCodeBuild bundle version code stored on the asset.
bool isAlwaysOnFocusEditor only: makes the game act as if the window always has focus.
32 private and internal fields
MemberWhat it is
private MenuSettings.AfterStartActionType afterStartActionBacking field for AfterStartAction.
private AnimationCurve distanceToHapticStrengthBacking field for DistanceToHapticstrength.
private AnimationCurve distanceToScreenFadeBacking field for DistanceToScreenFade.
private Material elementNormalMaterialBacking field for ElementNormalMaterial.
private Material elementSelectedMaterialBacking field for ElementSelectedMaterial.
private Color emptyPingBarColorBacking field for EmptyPingBarColor.
private string[] gameScenesBacking field for GameScenes.
private static TaskCompletionSource<GameObject> instantiatingPlatformManagerTaskPending load of the platform manager, so parallel calls to InstantiatePlatformManagerAsync wait for one load.
private bool isClearingSaveWhenDirectLaunchingWhether local test saves are cleared on direct launch.
private bool isDisablingAstarCalculationBacking field for IsDisablingAstarCalculation.
private bool isDisablingOculusServicesInEditorBacking field for IsDisablingOculusServicesInEditor.
private bool isForcedHeadlessBacking field for IsForcedHeadless.
private bool isJoiningTutorialFirstTimeInEditorBacking field for IsJoiningTutorialFirstTimeInEditor.
private bool isRequestingOwnedItemsInEditorBacking field for IsRequestingOwnedItemsInEditor.
private int[] minPingPerLevelBacking field for MinPingPerLevel; defaults to 35, 100 and 250 ms.
private float minPointerPrefabSizeForInflationBacking field for MinPointerPrefabSizeForInflation.
private string noInternetSceneBacking field for NoInternetScene.
private Gradient pingBarColorBacking field for PingBarColor.
private Color pingColorHighlightBacking field for PingColorHighlight.
private static GameObject platformManagerThe platform manager object, loaded once from Addressables and kept across scenes.
private Gradient playabilityColorGradientBacking field for PlayabilityColorGradient.
private float pointerPrefabInflationMultiplierBacking field for PointerPrefabInflationMultiplier.
private string registrationSceneBacking field for RegistrationScene.
private Material selectionOrbInFaceMaterialBacking field for SelectionOrbInFaceMaterial.
private Material selectionOrbInvalidMaterialBacking field for SelectionOrbInvalidMaterial.
private float selectionOrbLetGoThresholdBacking field for SelectionOrbLetGoThreshold.
private Material selectionOrbValidMaterialBacking field for SelectionOrbValidMaterial.
private bool startLocalTestOnServerJoinFailBacking field for StartLocalTestOnServerJoinFail.
private bool startMenuSceneOnServerJoinFailBacking field for StartMenuSceneOnServerJoinFail.
private Color toggleOffColorBacking field for ToggleOffColor.
private Color toggleOnColorBacking field for ToggleOnColor.
private string vrMenuSceneBacking field for MenuSceneName.

Properties​

MemberWhat it is
MenuSettings.AfterStartActionType AfterStartAction { get; set; }What the game does after startup in a dev build (none, local test, local server, join local server). Read only in debug inspector.
AnimationCurve DistanceToHapticstrength { get; }Curve from distance to haptic strength, used by the menu selection orbs.
AnimationCurve DistanceToScreenFade { get; }Curve from distance to screen fade amount, used by the menu selection orbs.
Material ElementNormalMaterial { get; }Material for a server list element that is not selected.
Material ElementSelectedMaterial { get; }Material for the selected server list element.
Color EmptyPingBarColor { get; }Colour of the unfilled bars in a server's ping indicator.
string[] GameScenes { get; }Names of the scenes that can be loaded as a game world.
bool IsDisablingAstarCalculation { get; }Editor only: skips A* pathfinding work in play mode to start faster, which stops creature pathfinding.
bool IsDisablingOculusServicesInEditor { get; }Editor only: skips Oculus services startup in play mode to start faster.
bool IsForcedHeadless { get; }Forces headless mode.
bool IsJoiningTutorialFirstTimeInEditor { get; }Editor only: whether a first-time player is sent to the tutorial.
bool IsRequestingOwnedItemsInEditor { get; }Editor only: whether to fetch the player's owned items.
int LocalGameScene { get; }Index in GameScenes of the active scene, or -1 (with an error log) if it is not a game scene.
string LocalGameSceneName { get; }Name of the active game scene, from GameScenes at LocalGameScene.
string MenuSceneName { get; }Name of the VR main menu scene.
int[] MinPingPerLevel { get; }Ping thresholds in ms for each ping bar level (default 35, 100, 250).
float MinPointerPrefabSizeForInflation { get; }Minimum pointer bounds size before PointerPrefabInflationMultiplier is applied.
string NoInternetScene { get; }Name of the scene shown when there is no internet connection.
Gradient PingBarColor { get; }Gradient used to colour the ping bars.
Color PingColorHighlight { get; }Highlight colour for the ping indicator.
Gradient PlayabilityColorGradient { get; }Gradient a server element evaluates with the server's playability value to pick its colour.
float PointerPrefabInflationMultiplier { get; }How much pointer target bounds are scaled up to make small objects easier to point at.
string RegistrationScene { get; }Name of the account registration scene.
Material SelectionOrbInFaceMaterial { get; }Material for a menu selection orb held close to the face.
Material SelectionOrbInvalidMaterial { get; }Material for a menu selection orb in an invalid spot.
float SelectionOrbLetGoThreshold { get; }Distance from the head within which a held action orb counts as used when let go.
Material SelectionOrbValidMaterial { get; }Material for a menu selection orb in a valid spot.
bool StartLocalTestOnServerJoinFail { get; }If set, startup falls back to a local test when joining a server fails.
bool StartMenuSceneOnServerJoinFail { get; }If set, startup falls back to the menu scene when joining a server fails.
Color ToggleOffColor { get; }Colour of a server selection toggle when off.
Color ToggleOnColor { get; }Colour of a server selection toggle when on.

Methods​

MemberWhat it is
async Task<bool> HandleStartupActionAsync()Stub in this build: always returns false without doing anything.
static async Task InstantiatePlatformManagerAsync()Loads the addressable <platform>/Platform Manager prefab once, keeps it across scene loads, and waits if a load is already running.
IServerAccess LocalGameServerAccess(int sceneIndex = -1)Server access for a local loopback server, for a scene index or the active scene. Used by local test commands.
GameServerInfo LocalGameServerInfo(int sceneIndex = -1)Builds the server info for a local dev server: loopback address, port 1757, the given or active scene index.
1 private and internal method
MemberWhat it is
private void InitLocalServerSave()Deletes the local server save if isClearingSaveWhenDirectLaunching is set. Nothing calls it.