/// <summary>
        /// When we build using BuildPlayerStep with BuildOptions.AutoRunPlayer we run the player before CopyAdditionallyProvidedFilesStep is executed
        /// Sometimes you'll get lucky, since while the player is launching, CopyAdditionallyProvidedFilesStep will be executed in time
        /// And subscenes will be found...But in other cases, the player will launch without subscenes
        /// By using OnPostprocessBuild, we ensure all our steps are executed before running the player.
        /// The code is not pretty, but it's also temporary until we implement missing pipelines with their respective Run functions
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private BuildResult OnBuildSplit(BuildContext context)
        {
            var  normalSteps                = new List <Type>();
            var  postProcessSteps           = new List <Type>();
            bool buildPlayerStepEncountered = false;

            foreach (var b in BuildSteps)
            {
                if (buildPlayerStepEncountered)
                {
                    postProcessSteps.Add(b.GetType());
                }
                else
                {
                    normalSteps.Add(b.GetType());
                }

                if (b.GetType() == typeof(BuildPlayerStep))
                {
                    buildPlayerStepEncountered = true;
                }
            }

            var normalStepsCollection = new BuildStepCollection(normalSteps.ToArray());

            s_CachedPostProcessCollection = new BuildStepCollection(postProcessSteps.ToArray());
            s_CachedContext = context;

            var result = normalStepsCollection.Run(context);

            s_CachedPostProcessCollection = null;
            s_CachedContext = null;

            return(result);
        }
        public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
        {
            if (s_CachedPostProcessCollection == null || s_CachedContext == null)
            {
                return;
            }
            if (s_CachedPostProcessCollection.Count() == 0)
            {
                return;
            }
            var result = s_CachedPostProcessCollection.Run(s_CachedContext);

            if (result.Failed)
            {
                throw new Exception(result.ToString());
            }
        }