示例#1
0
        internal static BuildPipelineResult DoBuild(NPath asmdef, BuildTarget buildTarget, bool runBee = true, Action <BuildContext> onBuildCompleted = null)
        {
            var relativePath = asmdef.RelativeTo(".");
            var name         = asmdef.FileNameWithoutExtension;
            var outputDir    = new DirectoryInfo("./Library/DotsRuntimeBuild");
            var stagingDir   = outputDir.Combine(name);
            var dataDir      = stagingDir.Combine("Data");

            var profile = new DotsRuntimeBuildProfile
            {
                RootAssembly  = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(relativePath.ToString()),
                Target        = buildTarget,
                Configuration = BuildConfiguration.Debug
            };

            var buildSettings = BuildSettings.CreateInstance((bs) =>
            {
                bs.hideFlags = HideFlags.HideAndDontSave;
                bs.SetComponent(profile);
                bs.SetComponent(new OutputBuildDirectory {
                    OutputDirectory = $"Library/DotsRuntimeBuild/build/Mole3D/{profile.BeeTargetName}"
                });
            });

            var convSettings = new ConversionSystemFilterSettings("Unity.Rendering.Hybrid");

            buildSettings.SetComponent(convSettings);

            var sceneList     = new SceneList();
            var rootScenePath = ConversionUtils.GetScenePathForSceneWithName(name);
            var scene         = AssetDatabase.LoadAssetAtPath <SceneAsset>(rootScenePath);

            sceneList.Scenes.Add(GlobalObjectId.GetGlobalObjectIdSlow(scene));
            buildSettings.SetComponent(sceneList);

            var buildPipeline = BuildPipeline.CreateInstance((pipeline) =>
            {
                pipeline.hideFlags = HideFlags.HideAndDontSave;
                pipeline.BuildSteps.Add(new BuildStepExportEntities());
                pipeline.BuildSteps.Add(new BuildStepExportConfiguration());
                pipeline.BuildSteps.Add(new BuildStepGenerateBeeFiles());
                if (runBee)
                {
                    pipeline.BuildSteps.Add(new BuildStepRunBee());
                }
                ;
            });

            // Run build pipeline
            using (var progress = new BuildProgress($"Build {profile.Target.DisplayName} {profile.Configuration}", "Building..."))
            {
                return(buildPipeline.Build(buildSettings, progress));
            }
        }
示例#2
0
        public LoadedSceneScope(string ident, bool isName = false)
        {
            var path      = isName ? ConversionUtils.GetScenePathForSceneWithName(ident) : ident;
            var projScene = SceneManager.GetSceneByPath(path);

            m_sceneLoaded = projScene.IsValid() && projScene.isLoaded;
            if (!m_sceneLoaded)
            {
                ProjectScene = EditorSceneManager.OpenScene(path, UnityEditor.SceneManagement.OpenSceneMode.Additive);
            }
            else
            {
                ProjectScene = projScene;
            }
        }
示例#3
0
 public LoadedSceneScope(string ident, bool isName = false)
 {
     LoadScene(isName ? ConversionUtils.GetScenePathForSceneWithName(ident) : ident);
 }