Application.platform 平台

来源:互联网 发布:2016年云计算发展趋势 编辑:程序博客网 时间:2024/06/11 18:23

返回游戏运行的平台(只读)。

function Start () {if (Application.platform == RuntimePlatform.WindowsPlayer)print ("Do something special here!");}

注意:使用RuntimePlatform和Platform两者是不同的,取决于编译是使用RuntimePlatform在运行时判断的,还是Platform取决于编译在编译时判断的。因此如果可以使用platform取决于编译,不要犹豫使用它。大多数情况下,可以使用这两种获得相同的功能,使用定义将产生更小和更快代码,因为你不需要在运行时检查。有些情况下必须使用RuntimePlatform,例如,如果需要检查那个平台运行webplayer,这个可以在运行时检查 。

Values

  • OSXEditor
    In the Unity editor on Mac OS X.
    在Mac OS X 平台的Unity 编辑器中。
  • OSXPlayer
    In the player on Mac OS X.
    在Mac OS X 平台的播放器中。
  • WindowsPlayer
    In the player on Windows.
    在Windows平台的播放器中。
  • OSXWebPlayer
    In the web player on Mac OS X.
    在Mac OS X平台的web播放器中。
  • OSXDashboardPlayer
    In the Dashboard widget on Mac OS X.
    在Mac OS X平台的Dashboard widget(仪表板小工具)中。
  • WindowsWebPlayer
    In the web player on Windows.
    在Windows平台的web播放器中。
  • WiiPlayer
    In the player on Nintendo Wii.
    在Nintendo Wii平台的播放器中。
  • WindowsEditor
    In the Unity editor on Windows.
    在Windows平台的Unity编辑器中。
  • IPhonePlayer
    In the player on the iPhone.
    在iPhone平台的播放器中。
  • XBOX360
    In the player on the XBOX360
    在XBOX360平台的播放器中。
  • PS3
    In the player on the Play Station 3
    在PS3平台的播放器中。
  • Android
    In the player on Android devices.
    在Android平台的播放器中。


原创粉丝点击