Skip to main content

PlatformProvider

A static class in Alta.PlatformInformation.Runtime, Alta.PlatformInformation.

Static helper that tells which platform the game is running on (Windows, Linux, Android, Quest, Pico), with an optional client override for testing.

Fields​

MemberWhat it is
const string ANDROID_DEFINEScripting define for Android builds.
const string LINUX_DEFINEScripting define for Linux builds.
const string PICO_DEFINEScripting define for Pico builds.
const string QUEST_DEFINEScripting define for Quest builds.
const string WINDOWS_DEFINEScripting define for Windows builds.
9 private and internal fields
MemberWhat it is
private const string AndroidNameName returned for Android.
private const string AndroidPreviewNameName returned for Android preview.
private const string LinuxNameName returned for Linux.
private static readonly LocalPlatformProvider LocalProviderDetects the real platform.
private static readonly OverridePlatformProvider OverrideProviderHolds the client runtime override, if set.
private const string PicoNameName returned for Pico.
private const string QuestNameName returned for Quest.
private const string UnknownNameName returned for an unknown platform.
private const string WindowsNameName returned for Windows.

Properties​

MemberWhat it is
static PlatformFlags PlatformFlags { get; }The current platform: the override if one is set, otherwise the detected one.
static string PlatformName { get; }The current platform as a string, such as "Quest" or "Windows".

Events​

MemberWhat it is
static event Action OnOverrideRuntimePlatformRaised after SetClientRuntimeOverride changes the reported platform.

Methods​

MemberWhat it is
static void ClearClientRuntimeOverride()Removes the runtime override so the real platform is reported again.
static bool IsActiveRuntime(PlatformFlags input)Extension: true if the current platform matches the given flags.
static bool IsAndroid()True on Quest or Pico. On a plain Android runtime it returns false, because of how the flag check works.
static bool IsAndroidOrAndroidPreview()True for IsAndroid or IsAndroidPreview.
static bool IsAndroidPreview()True when running as Android preview.
static bool IsClient()True on anything except Linux.
static bool IsLinux()True on the Linux platform.
static bool IsPico()True on Pico.
static bool IsQuest()True on Quest.
static bool IsServer()True on Linux. The dedicated server is the Linux build, so this is a platform check, not a network role.
static bool IsWindows()True on Windows.
static void SetClientRuntimeOverride(PlatformFlags runtime)Makes the game report a different platform and raises OnOverrideRuntimePlatform. Throws for plain Android; use Quest or Pico.
2 private and internal methods
MemberWhat it is
private static bool HasFlag(PlatformFlags input)True if the current platform matches any of the given flags. Treats the Android bit as matching Quest and Pico.
private static bool IsAndroidSubPlatform(PlatformFlags input)True if the given flags mean Android in general and the platform is Quest or Pico.