Bootstrap

Unity 判断运行平台


在项目里,我们常常会有判断运行平台的需求,我在这里给大家提供两种方法,以供参考。

1. 使用Application.platform判断

Application.platform是UnityEngine命名空间下RuntimePlatform枚举类型,使用方法如下:

        void Awake()
        {
   
            switch (Application.platform) 
            {
   
                case RuntimePlatform.OSXEditor:
              
;