Exemplo n.º 1
0
        public override BuildStepResult RunBuildStep(BuildContext context)
        {
            m_TemporaryFileTracker = new TemporaryFileTracker();

            // Delete SubScenes build folder defensively (Eg. if unity crashes during build)
            var streamingAssetsSubscenes = "Assets/StreamingAssets/SubScenes";

            FileUtil.DeleteFileOrDirectory(streamingAssetsSubscenes);

            m_TemporaryFileTracker.CreateDirectory(streamingAssetsSubscenes);

            List <(string sourceFile, string destinationFile)> filesToCopy = new List <(string sourceFile, string destinationFile)>();

            void RegisterFileCopy(string sourceFile, string destinationFile)
            {
                filesToCopy.Add((sourceFile, destinationFile));
            }

            SubSceneBuildCode.PrepareAdditionalFiles(BuildContextInternals.GetBuildConfigurationGUID(context), type => GetRequiredComponent(context, type), RegisterFileCopy, Application.streamingAssetsPath, $"Library/SubsceneBundles");

            foreach (var(sourceFile, targetFile) in filesToCopy)
            {
                m_TemporaryFileTracker.TrackFile(targetFile);
                File.Copy(sourceFile, targetFile, true);
            }

            return(Success());
        }
Exemplo n.º 2
0
        public override void RegisterAdditionalFilesToDeploy(Action <string, string> registerAdditionalFileToDeploy)
        {
            SubSceneBuildCode.PrepareAdditionalFiles(
                Context.BuildConfigurationAssetGUID,
                EmbeddedScenes,
                BuildTarget,
                registerAdditionalFileToDeploy,
                StreamingAssetsDirectory,
                $"Library/SubsceneBundles");

            var sceneList = Context.GetComponentOrDefault <SceneList>();
            var tempFile  = System.IO.Path.Combine(WorkingDirectory, SceneSystem.k_SceneInfoFileName);

            ResourceCatalogBuildCode.WriteCatalogFile(sceneList, tempFile);
            registerAdditionalFileToDeploy(tempFile, System.IO.Path.Combine(StreamingAssetsDirectory, SceneSystem.k_SceneInfoFileName));
        }
        public override void RegisterAdditionalFilesToDeploy(Action <string, string> registerAdditionalFileToDeploy)
        {
            if (!Context.HasValue <EntitySectionBundlesInBuild>())
            {
                return;
            }

            var binaryFiles = Context.GetValue <EntitySectionBundlesInBuild>();

            // Additional pre-checks to detect when the same SceneGUID or artifacts are added multiple times which will fail the builder further on.
#if false
            if (binaryFiles.SceneGUID.Distinct().Count() != binaryFiles.SceneGUID.Count())
            {
                throw new ArgumentException("Some of the EntityScenes guids in build are not unique");
            }
            if (binaryFiles.ArtifactKeys.Distinct().Count() != binaryFiles.ArtifactKeys.Count())
            {
                throw  new ArgumentException("Some of the EntityScenes target resolved guids in build are not unique");
            }
#endif

            SubSceneBuildCode.PrepareAdditionalFiles(
                binaryFiles.SceneGUID.ToArray(), binaryFiles.ArtifactKeys.ToArray(), BuildTarget, registerAdditionalFileToDeploy, StreamingAssetsDirectory, $"Library/SubsceneBundles");
        }
Exemplo n.º 4
0
 protected override void OnPrepareAdditionalAssetsBeforeBuild()
 {
     SubSceneBuildCode.PrepareAdditionalFiles(BuildConfigurationGuid, GetComponent, AddFile, StreamingAssetsDirectory, $"Library/SubsceneBundles");
 }