Class PlatformUtil
Provides platform detection, build configuration queries, and device capability information for the current runtime environment.
Inherited Members
Namespace: Scylla.Core.Util
Assembly: ScyllaCore.dll
Syntax
public static class PlatformUtil
Remarks
Platform category properties such as IsDesktop, IsMobile, and IsConsole query UnityEngine.Application.platform at runtime and reflect the actual platform the application is running on - not the build target set in the Editor.
Build configuration properties (IsEditor, IsDebugBuild,
IsProfilerEnabled) are compile-time constants evaluated via preprocessor
symbols and therefore resolve to a constant true or false with no
runtime overhead.
Device capability properties (HasTouchscreen, SupportsGyroscope, etc.) are lazily evaluated and then cached the first time they are accessed. Subsequent accesses read from the cache at near-zero cost. Do not call these from the Editor play session if you need accurate device data - they reflect the host machine, not any simulated device.
Properties
DeviceModel
Gets the device model identifier as reported by the manufacturer or OS (e.g., "iPhone14,2" or "SM-G998B"). Delegates directly to UnityEngine.SystemInfo.deviceModel.
Declaration
public static string DeviceModel { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The format of this string varies widely by platform and is intended for
diagnostic logging rather than capability branching. Use the individual
Is* platform properties for platform-specific code paths.
DeviceName
Gets the human-readable name of the device as reported by the operating system (e.g., the computer name or phone model string). Delegates directly to UnityEngine.SystemInfo.deviceName.
Declaration
public static string DeviceName { get; }
Property Value
| Type | Description |
|---|---|
| string |
GraphicsMemoryMB
Gets the amount of dedicated GPU video memory in megabytes as reported by Unity. Delegates to UnityEngine.SystemInfo.graphicsMemorySize.
Declaration
public static int GraphicsMemoryMB { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
On systems with shared memory (UMA architectures such as Apple Silicon or many mobile GPUs) this value may reflect the portion reserved for GPU use and can be less accurate. Use it as a rough guide for GPU memory budget decisions.
HasSharpZipLib
Returns true if the Unity SharpZipLib package (com.unity.sharp-zip-lib
version 1.4.1 or later) is available to the running build.
Declaration
public static bool HasSharpZipLib { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
When this property is false, ScyllaCompression falls back to GZip and
Deflate only. BZip2 compression and ZIP archive creation/extraction require this
package. Add com.unity.sharp-zip-lib via the Package Manager to unlock these
capabilities. When Scylla is consumed as a precompiled assembly, this reflects whether
the package is actually present at runtime (see OptionalPackages), not
merely whether the assembly was compiled with the version define.
HasTouchscreen
Returns true if the device has a touchscreen. The result is determined by
checking whether the platform is mobile (IsMobile) or
UnityEngine.Input.touchSupported reports support. The value is cached after the
first access.
Declaration
public static bool HasTouchscreen { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
On desktop platforms this checks the OS-level touch API. A Surface Pro or a
touchscreen monitor will return true even on Windows.
IsAndroid
Returns true if the application is running on an Android device.
Declaration
public static bool IsAndroid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsConsole
Returns true if the application is running on a dedicated game console:
any PlayStation, Xbox, or Nintendo Switch variant.
Declaration
public static bool IsConsole { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
IsDebugBuild
Returns true if the application was compiled as a debug or development
build (i.e., the DEBUG or DEVELOPMENT_BUILD preprocessor symbol
is defined).
Declaration
public static bool IsDebugBuild { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Development builds include the Unity Profiler connection stub and enable the development console. Use this property to toggle additional logging, debug visualisations, or cheat commands that should not be present in release builds.
See Also
IsDesktop
Returns true if the application is running on a desktop operating system:
Windows, macOS, or Linux (both player and editor builds are included).
Declaration
public static bool IsDesktop { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
IsDualInputEnabled
Returns true if both the new Input System package and the legacy
Input Manager are enabled simultaneously ("Both" mode in Project Settings).
Declaration
public static bool IsDualInputEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Running both input backends simultaneously incurs additional overhead. Prefer
using the new Input System exclusively (IsInputSystemEnabled) in
new projects unless third-party code still requires Input.GetAxis or
similar legacy APIs.
See Also
IsEditor
Returns true if the application is running inside the Unity Editor,
as opposed to a standalone player build.
Declaration
public static bool IsEditor { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This property is a compile-time constant: the compiler strips the unreachable branch entirely, so checking it carries zero runtime cost. Use it to gate Editor-only diagnostics or developer shortcuts that must not ship to end users.
IsIOS
Returns true if the application is running on an iOS device (iPhone or iPad).
Declaration
public static bool IsIOS { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsInputSystemEnabled
Returns true if the Unity Input System package is enabled
(the ENABLE_INPUT_SYSTEM preprocessor symbol is defined).
Declaration
public static bool IsInputSystemEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Scylla's Input module requires the Input System package and will assert that
this property is true during initialization. Use this property to
gate Input-System-specific code paths in shared or editor utilities.
See Also
IsLegacyInputEnabled
Returns true if Unity's legacy Input Manager is enabled
(the ENABLE_LEGACY_INPUT_MANAGER preprocessor symbol is defined).
Declaration
public static bool IsLegacyInputEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
The legacy Input Manager is disabled by default when the Input System package
is set to "Input System Package (New)" in Project Settings. When set to
"Both", both IsLegacyInputEnabled and IsInputSystemEnabled
will return true.
See Also
IsLinux
Returns true if the application is running on Linux - either as a standalone
player build or inside the Unity Editor on a Linux machine.
Declaration
public static bool IsLinux { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsMobile
Returns true if the application is running on a mobile platform:
iOS or Android.
Declaration
public static bool IsMobile { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
IsOSX
Returns true if the application is running on macOS - either as a standalone
player build or inside the Unity Editor on a macOS machine.
Declaration
public static bool IsOSX { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPS5
Returns true if the application is running on a PlayStation 5 console.
Declaration
public static bool IsPS5 { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPlayStation
Returns true if the application is running on any PlayStation console
(PS4 or PS5). Use IsPS5 to target the PS5 specifically.
Declaration
public static bool IsPlayStation { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsProfilerEnabled
Returns true if the Unity Profiler instrumentation is compiled in
(the ENABLE_PROFILER preprocessor symbol is defined).
Declaration
public static bool IsProfilerEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
The Profiler is automatically enabled in development builds and in the Unity Editor. In release builds it is stripped unless explicitly re-enabled in Player Settings. Use this property to guard performance-heavy profiler marker setup that should not run in stripped release builds.
IsReleaseBuild
Returns true if the application is a release build - i.e., neither
the DEBUG nor the DEVELOPMENT_BUILD preprocessor symbol is defined.
Declaration
public static bool IsReleaseBuild { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
IsSwitch
Returns true if the application is running on a Nintendo Switch console.
Declaration
public static bool IsSwitch { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsTVOS
Returns true if the application is running on Apple tvOS.
Declaration
public static bool IsTVOS { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsWSA
Returns true if the application is running as a Windows Store App (UWP),
on any CPU architecture: x64, x86, or ARM.
Declaration
public static bool IsWSA { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsWeb
Returns true if the application is running on a web platform (WebGL).
Declaration
public static bool IsWeb { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
IsWebGL
Returns true if the application is running as a WebGL build in a browser.
Declaration
public static bool IsWebGL { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
WebGL builds have significant restrictions: no threading, limited memory, no filesystem access, and no clipboard API unless explicitly bridged via JavaScript.
IsWindows
Returns true if the application is running on Windows - either as a standalone
player build or inside the Unity Editor on a Windows machine.
Declaration
public static bool IsWindows { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsXbox
Returns true if the application is running on any Xbox console
(Xbox One or Xbox Series X|S via Game Core). Use IsXboxSeries to
target Xbox Series X|S specifically.
Declaration
public static bool IsXbox { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsXboxSeries
Returns true if the application is running on an Xbox Series X or
Xbox Series S console (Game Core runtime).
Declaration
public static bool IsXboxSeries { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MaxTextureSize
Gets the maximum texture dimension (width or height) supported by the GPU. Delegates to UnityEngine.SystemInfo.maxTextureSize.
Declaration
public static int MaxTextureSize { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Common values are 8192 (mobile), 16384 (mainstream desktop), and 32768 (high-end GPUs). Attempting to create a texture larger than this value will either fail silently or clamp the size depending on the platform.
OperatingSystem
Gets the operating system name and version string as reported by Unity (e.g., "Windows 11 (10.0.22000) 64bit"). Delegates to UnityEngine.SystemInfo.operatingSystem.
Declaration
public static string OperatingSystem { get; }
Property Value
| Type | Description |
|---|---|
| string |
ProcessorCount
Gets the number of logical processor cores available to the application. Delegates to UnityEngine.SystemInfo.processorCount.
Declaration
public static int ProcessorCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Hyper-threading doubles the reported count on Intel CPUs. Use this value to size thread pools or job worker counts, keeping at least one core free for OS and Unity's own threads.
ProcessorType
Gets the processor model name as reported by the OS (e.g., "Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz"). Delegates to UnityEngine.SystemInfo.processorType.
Declaration
public static string ProcessorType { get; }
Property Value
| Type | Description |
|---|---|
| string |
SupportsAccelerometer
Returns true if the device exposes a hardware accelerometer. The value is
cached after the first access.
Declaration
public static bool SupportsAccelerometer { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Available on most mobile devices. Reading accelerometer data on devices that
report support is done via Input.acceleration (legacy) or the
Accelerometer sensor in the new Input System.
SupportsComputeShaders
Returns true if the GPU supports compute shaders (DirectCompute, Metal
compute, or Vulkan compute). The value is cached after the first access.
Declaration
public static bool SupportsComputeShaders { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Compute shaders are supported on all modern desktop and console GPUs but may not be available on older mobile hardware (OpenGL ES 2.0 devices). Check this property before dispatching any compute work, especially when targeting a broad device range.
SupportsGyroscope
Returns true if the device exposes a hardware gyroscope. The value is
cached after the first access.
Declaration
public static bool SupportsGyroscope { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Most smartphones and tablets include a gyroscope. Desktop platforms and consoles
typically return false.
SupportsLocationService
Returns true if the device supports location services (GPS). The value
is cached after the first access.
Declaration
public static bool SupportsLocationService { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Location service access on iOS and Android additionally requires the appropriate permission in the app manifest and user consent at runtime.
SupportsVibration
Returns true if the device supports haptic feedback or vibration
(rumble). The value is cached after the first access.
Declaration
public static bool SupportsVibration { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
On mobile this maps to the platform vibration API. On consoles it maps to the gamepad rumble motor. Trigger UnityEngine.Handheld.Vibrate() on mobile or use a gamepad rumble API to activate it.
SystemMemoryMB
Gets the total system RAM in megabytes as reported by Unity. Delegates to UnityEngine.SystemInfo.systemMemorySize.
Declaration
public static int SystemMemoryMB { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
The returned value represents physical RAM and does not account for virtual memory. Use it for rough memory budget decisions; actual available memory at runtime may differ due to OS reserved regions.