Version: 2023.2

Application

class in UnityEngine

切换到手册

描述

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.
isPlayingReturns true when called in any kind of built Player, or when called in the Editor in Play mode (Read Only).
persistentDataPathContains the path to a persistent data directory (Read Only).
platform返回游戏运行平台(只读)。
productName返回应用程序产品名称(只读)。
runInBackgroundShould the Player be running when the application is in the background?
sandboxType返回在沙盒中运行的应用程序(只读)。
streamingAssetsPathThe path to the StreamingAssets folder (Read Only).
systemLanguage用户操作系统运行时所使用的语言。
targetFrameRateSpecifies the frame rate at which Unity tries to render your game.
temporaryCachePath包含临时数据/缓存目录的路径(只读)。
unityVersion用于播放内容的 Unity 运行时版本。
version返回应用程序版本号(只读)。

静态函数

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 advertising ID for iOS and Windows Store.
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收到日志消息时触发的事件。
lowMemoryThis event occurs when your app receives a low-memory notification from the device it is running on.
memoryUsageChangedInforms about significant changes in the application's memory usage.
onBeforeRender用于注册 VR 设备的“Just Before Render”输入更新的委托方法。
quittingUnity raises this event when the Player application is quitting.
unloadingUnity raises this event when Player is unloading.
wantsToQuitUnity raises this event when the Player application wants to quit.

委托

AdvertisingIdentifierCallback用于获取广告 ID 的委托方法。
LogCallback将此委托类型与 Application.logMessageReceived 或 Application.logMessageReceivedThreaded 结合使用来监控记录内容。
LowMemoryCallback这是移动设备通知内存不足时调用的委托函数。
MemoryUsageChangedCallbackA delegate for the Application.memoryUsageChanged vent.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961