Exemplo n.º 1
0
    static void PerformBuild()
    {
        string[] scenes = { "Assets/Scenes/SampleScene.unity" };
        //BuildPipeline.BuildPlayer(scenes, "Build/Win/Test.exe",
        //     BuildTarget.StandaloneWindows64,
        //     BuildOptions.None);

        //Build
        BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();

        buildPlayerOptions.scenes           = scenes;
        buildPlayerOptions.locationPathName = "./builds/test.apk";
        buildPlayerOptions.target           = BuildTarget.Android;
        buildPlayerOptions.options          = BuildOptions.None;

        UnityEditor.Build.Reporting.BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
        UnityEditor.Build.Reporting.BuildSummary summary = report.summary;

        if (summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
        {
            Debug.Log("<color=green>Build succeeded: " + summary.totalSize + " bytes</color>");
        }

        if (summary.result == UnityEditor.Build.Reporting.BuildResult.Failed)
        {
            Debug.Log("<color=red>Build failed</color>");
        }
    }
Exemplo n.º 2
0
    public static void BuildNavMeshBundles(string streamPath, BuildTarget target)
    {
        string path = "Assets/AssetBundleRes/scene/navmesh";

        string[] file_paths = Directory.GetFiles(path);
        // List<string> levels = new List<string>();
        foreach (string file_path in file_paths)
        {
            string ext = Path.GetExtension(file_path);
            if (ext.Equals(".unity"))
            {
                string navmesh_scene_name = Path.GetFileNameWithoutExtension(file_path);
                // levels.Add(file_path);
                string[] levels = new string[] { file_path };
                Debug.Log("file : " + file_path + " save : " + streamPath + "/" + navmesh_scene_name + " target:" + target.ToString());

                BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
                buildPlayerOptions.scenes           = new string[] { file_path };
                buildPlayerOptions.locationPathName = streamPath + "/" + navmesh_scene_name;
                buildPlayerOptions.target           = target;
                buildPlayerOptions.options          = BuildOptions.BuildAdditionalStreamedScenes;

                UnityEditor.Build.Reporting.BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
                UnityEditor.Build.Reporting.BuildSummary summary = report.summary;
                if (summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
                {
                    Debug.Log("Build navmesh succeeded: " + summary.totalSize + " bytes");
                }

                if (summary.result == UnityEditor.Build.Reporting.BuildResult.Failed)
                {
                    Debug.Log("Build navmesh failed : " + file_path);
                }
                // BuildPipeline.BuildPlayer(levels, streamPath+"/"+navmesh_scene_name, target, BuildOptions.BuildAdditionalStreamedScenes);
            }
        }
    }
Exemplo n.º 3
0
 private extern void get_summary_Injected(out BuildSummary ret);