public static void EnsureBuilt(BuildTarget platform, bool setStreamingAssets) { string directory = DirUtils.PlatformBundle(platform); bool mustBuild = !Directory.Exists(directory); bool platformChange = (platform != EditorUserBuildSettings.activeBuildTarget); if (mustBuild) { BuildPlatform(platform, directory); } if (setStreamingAssets && (mustBuild || platformChange)) { var group = BuildPipeline.GetBuildTargetGroup(platform); EditorUserBuildSettings.SwitchActiveBuildTarget(group, platform); DirUtils.RmStreamingBundle(); DirUtils.Cp(directory, Application.streamingAssetsPath); } }