Skip to main content

Class CrossPlatformSupportUtils

A utility class for handling platform-specific functionality and platform checks, including WebGL support checks, mobile platform detection, and WebGL alert displays.

public class CrossPlatformSupportUtils

Inheritance​

Methods​

DisplayAlert(string)​

Displays an alert message in WebGL builds or logs a warning in the Unity Editor.

public static void DisplayAlert(string str)

Parameters​

NameTypeDescription
strstringThe message to display in the WebGL alert or log as a warning in Unity Editor.

IsMobile()​

Checks if the application is running on a mobile platform in a WebGL build.

public static bool IsMobile()

Returns​

bool — Returns true if running on a mobile platform in WebGL, false otherwise.

IsWebGLSupported()​

public static extern bool IsWebGLSupported()

Returns​

bool

OpenBlankPage()​

public static extern void OpenBlankPage()

Quit()​

Quits the game safely. The behavior of Quit() is platform-specific. In the editor, stops play mode; on WebGL, opens a blank page in the same tab; otherwise quits the app.

public static void Quit()

WebGLSupported()​

Checks if WebGL is supported in the current build.

public static bool WebGLSupported()

Returns​

bool — Returns true if WebGL is supported, false otherwise.

WindowAlert(string)​

public static extern void WindowAlert(string text)

Parameters​

NameTypeDescription
textstring
  • Methods
    • DisplayAlert(string)
    • IsMobile()
    • IsWebGLSupported()
    • OpenBlankPage()
    • Quit()
    • WebGLSupported()
    • WindowAlert(string)