在生成AssetBundle的时候,如果目标平台和当前平台不一致,Unity3D会自动将当前平台转换为目标平台。

如果项目中资源量比较大,这个转换过程是相当漫长的,并且不能够强行中止。

所以最好在BuildPipeline之前进行平台一致性检测,代码如下所示:

1

2

3

4

5

6

7

8

9

public static bool CheckPlatform(UnityEditor.BuildTarget target)

{

    if (EditorUserBuildSettings.activeBuildTarget != target)

    {

        EditorUtility.DisplayDialog("目标平台与当前平台不一致,请先进行平台转换""当前平台:" + EditorUserBuildSettings.activeBuildTarget + "\n目标平台:" + target, "OK");

        return false;

    }

    return true;

}

【转】AssetBundle系列——打包前进行平台检测

分类: Unity3D

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-03
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-02-11
  • 2021-10-27
  • 2021-11-20
相关资源
相似解决方案