正在运行的平台应用程序。由 Application.platform 返回。
注意:使用 RuntimePlatform 与平台相关的编译之间的不同在于 使用 RuntimePlatform 是在运行时评估的,而依赖于平台的编译是 在编译时评估的。因此,如果可以使用平台相关的编译,就不要犹豫。在大多数情况下,使用两者 可以获得相同的功能,使用这些定义可以生成更小更快的代码,因为无需在运行时进行检查。 也有一些情况需要在运行时使用 RuntimePlatform。
OSXEditor | 在 macOS 上的 Unity Editor 中。 |
OSXPlayer | 在 macOS 上的播放器中。 |
WindowsPlayer | 在 Windows 上的播放器中。 |
WindowsEditor | 在 Windows 上的 Unity Editor 中。 |
IPhonePlayer | 在 iPhone 上的播放器中。 |
Android | 在 Android 设备上的播放器中。 |
LinuxPlayer | 在 Linux 上的播放器中。 |
LinuxEditor | 在 Linux 上的 Unity Editor 中。 |
WebGLPlayer | 在 WebGL 上的播放器中。 |
WSAPlayerX86 | 当 CPU 架构为 X86 时在 Windows 应用商店应用程序上的播放器中。 |
WSAPlayerX64 | 当 CPU 架构为 X64 时在 Windows 应用商店应用程序上的播放器中。 |
WSAPlayerARM | 当 CPU 架构为 ARM 时在 Windows 应用商店应用程序上的播放器中。 |
PS4 | 在 Playstation 4 上的播放器中。 |
XboxOne | 在 Xbox One 上的播放器中。 |
tvOS | 在 Apple 的 tvOS 上的播放器中。 |
Switch | 在 Nintendo Switch 上的播放器中。 |
Stadia | 在 Stadia 上的播放器中。 |
CloudRendering | In the player on CloudRendering. |
PS5 | In the player on the Playstation 5. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.