Example #1
0
        internal static bool FinalizeBuild()
        {
            if (brushesBuilt > 0)
            {
                buildContext.WriteVisualMappings();
            }

            // Ensure a mesh group exists
            bool newGroupCreated = Prepare(rootTransform);

            if (brushesBuilt > 0 || polygonsRemoved || newGroupCreated)
            {
                MeshGroupManager.Cleanup(meshGroupHolder);

                MeshGroupManager.BuildVisual(meshGroupHolder, buildContext.VisualPolygonIndex, buildSettings, buildContext, materialMeshDictionary);

                if (buildSettings.GenerateCollisionMeshes)
                {
                    MeshGroupManager.BuildCollision(meshGroupHolder, buildContext.CollisionPolygonIndex, buildSettings, collisionMeshDictionary);
                }

                // All done
                DateTime time2 = DateTime.Now;

                buildContext.buildMetrics.BuildMetaData = (time1 - buildStartTime).TotalSeconds + " " + (time2 - time1).TotalSeconds + " " + brushesBuilt;
                buildContext.buildMetrics.BuildTime     = (float)(DateTime.Now - buildStartTime).TotalSeconds;
                buildInProgress = false;
                return(true);
            }
            else
            {
                buildInProgress = false;
                return(false);
            }
        }