Version: 2023.1

Application

class in UnityEngine

切换到手册

描述

Provides access to application runtime data.

This class contains static methods for looking up information about and controlling the runtime data.

静态变量

absoluteURLThe URL of the document. For WebGL, this is a web URL. For Android, iOS, or Universal Windows Platform (UWP) this is a deep link URL (Read Only).
backgroundLoadingPriority后台加载线程的优先级。
buildGUID返回此构建的 GUID(只读)。
cloudProjectId唯一的云端项目标识符。它对于每个项目而言都是唯一的(只读)。
companyNameReturns application company name (Read Only).
consoleLogPath返回控制台日志文件的路径,如果当前平台不支持日志文件,则返回空字符串。
dataPath包含目标设备上的游戏数据文件夹路径(只读)。
exitCancellationTokenCancellation token raised on exiting Play mode (Editor) or on quitting the application (Read Only).
genuine如果应用程序在构建后以任何方式进行了更改,则返回 false。
genuineCheckAvailable如果可以确认应用程序完整性,则返回 true。
identifierReturns the application identifier at runtime.
installerName返回安装应用程序的商店或包的名称(只读)。
installMode返回应用程序安装模式(只读)。
internetReachabilityReturns the type of internet reachability currently possible on the device.
isBatchMode如果从命令行以 **-batchmode** 标志启动了 Unity,则返回 true(只读)。
isConsolePlatform当前的运行时平台是否为已知的控制台平台?
isEditorWhether the game is running inside the Unity Editor (Read Only).
isFocusedWhether the Player currently has focus (Read-only).
isMobilePlatformIdentifies whether the current Runtime platform is a known mobile platform.
isPlaying在任何类型的已构建播放器中调用时,或者在播放模式的编辑器中调用时,返回 true(只读)。
persistentDataPathContains the path to a persistent data directory (Read-only).
platform返回游戏运行平台(只读)。
productName返回应用程序产品名称(只读)。
runInBackgroundDetermines whether the Player should run when the application is in the background
sandboxTypeReturns application running in a sandbox environment (Read-only).
streamingAssetsPathThe path to the StreamingAssets folder (Read Only).
systemLanguageThe language in which the user's operating system is running in.
targetFrameRateSpecifies the target frame rate at which Unity tries to render your game.
temporaryCachePath包含临时数据/缓存目录的路径(只读)。
unityVersion用于播放内容的 Unity 运行时版本。
versionReturns application version number (Read Only).

静态函数

CanStreamedLevelBeLoadedChecks if the streamed level can be loaded.
GetStackTraceLogType获取堆栈跟踪日志记录选项。默认值为 StackTraceLogType.ScriptOnly。
HasProLicenseUnity 是否是使用 Pro 许可证激活?
HasUserAuthorizationCheck if the user has authorized use of the webcam or microphone on iOS and WebGL.
IsPlaying如果给定对象是游戏世界的一部分(在任何类型的已构建播放器中或在播放模式中),则返回 true。
OpenURLOpens the URL specified, subject to the permissions and limitations of your app’s current platform and environment.
Quit退出播放器应用程序。
RequestAdvertisingIdentifierAsyncRequest an advertising ID for iOS and UWP.
RequestUserAuthorizationRequest authorization to use the webcam or microphone on iOS and WebGL.
SetStackTraceLogType设置堆栈跟踪日志记录选项。默认值为 StackTraceLogType.ScriptOnly。
UnloadUnloads the Unity Player.

Events

deepLinkActivated如果在 Android、iOS 或通用 Windows 平台 (UWP) 上运行的应用程序是使用深层链接 URL 激活,则会引发此事件。
focusChanged定义要用于注册在其中获得或失去焦点的事件的委托。
logMessageReceived收到日志消息时触发的事件。
logMessageReceivedThreaded收到日志消息时触发的事件。
lowMemoryThe Application._lowMemory event occurs when your application receives a low-memory notification from the device it is running on.
memoryUsageChangedInforms about significant changes in the application's memory usage.
onBeforeRenderA delegate method used to register for Just Before Render input updates for VR devices.
quittingUnity raises this event when the Player application is quitting.
unloadingUnity raises this event when the Player is unloading.
wantsToQuit当播放器应用程序想要退出时,Unity 会引发此事件。

委托

AdvertisingIdentifierCallback用于获取广告 ID 的委托方法。
LogCallback将此委托类型与 Application.logMessageReceived 或 Application.logMessageReceivedThreaded 结合使用来监控记录内容。
LowMemoryCallback这是移动设备通知内存不足时调用的委托函数。
MemoryUsageChangedCallbackA delegate for the Application.memoryUsageChanged vent.