{"record":{"id":"ebc9cc6bb779028d","repo":"egametang/ET","slug":"rcbuildcontours-multiple-outlines-for-region-con","errorCode":null,"errorMessage":"rcBuildContours: Multiple outlines for region {cont.reg}.","messagePattern":"rcBuildContours: Multiple outlines for region (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"Packages/cn.etetet.recast/Scripts/Core/Share/Recast/RecastContour.cs","lineNumber":903,"sourceCode":"                {\n                    // Collect outline contour and holes contours per region.\n                    // We assume that there is one outline and multiple holes.\n                    int nregions = chf.maxRegions + 1;\n                    RcContourRegion[] regions = new RcContourRegion[nregions];\n                    for (int i = 0; i < nregions; i++)\n                    {\n                        regions[i] = new RcContourRegion();\n                    }\n\n                    for (int i = 0; i < cset.conts.Count; ++i)\n                    {\n                        RcContour cont = cset.conts[i];\n                        // Positively would contours are outlines, negative holes.\n                        if (winding[i] > 0)\n                        {\n                            if (regions[cont.reg].outline != null)\n                            {\n                                throw new Exception(\n                                    \"rcBuildContours: Multiple outlines for region \" + cont.reg + \".\");\n                            }\n\n                            regions[cont.reg].outline = cont;\n                        }\n                        else\n                        {\n                            regions[cont.reg].nholes++;\n                        }\n                    }\n\n                    for (int i = 0; i < nregions; i++)\n                    {\n                        if (regions[i].nholes > 0)\n                        {\n                            regions[i].holes = new RcContourHole[regions[i].nholes];\n                            for (int nh = 0; nh < regions[i].nholes; nh++)\n                            {","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.recast/Scripts/Core/Share/Recast/RecastContour.cs#L885-L921","documentation":"Thrown in rcBuildContours during region hole-merging when a region (cont.reg) already has an outline contour and a second positive-winding (outline) contour is encountered for the same region. Each region should have exactly one outline; a second indicates the region topology is inconsistent (region IDs were not partitioned cleanly).","triggerScenarios":"Region partitioning (watershed/monotone/layer) producing fragmented regions that share an ID; aggressive contour simplification splitting one region into multiple outlines; thin region slivers.","commonSituations":"Very low minRegionArea allowing tiny regions; contour maxSimplificationError / maxEdgeLength interacting badly with complex geometry; watershed noise on nearly-planar scenes.","solutions":["Raise minRegionArea to discard tiny regions that fragment into multiple outlines.","Reduce contour maxSimplificationError (less aggressive simplification) to avoid splitting outlines.","Adjust region partitioning method (e.g., switch watershed -> monotone) for cleaner IDs.","Increase maxEdgeLength so contour edges merge rather than fragmenting."],"exampleFix":"// before\ncfg.minRegionArea = 2;\ncfg.maxSimplificationError = 2.0f;\n\n// after\ncfg.minRegionArea = 64;\ncfg.maxSimplificationError = 1.1f;","handlingStrategy":"validation","validationCode":"if (cfg.minRegionArea < 16) Debug.LogWarning(\"Tiny minRegionArea can fragment regions -> multiple outlines\");\nif (cfg.maxSimplificationError > 1.5f) Debug.LogWarning(\"High simplification error may split outlines\");","typeGuard":null,"tryCatchPattern":"try { var cset = RecastContour.BuildContours(ctx, chf, maxError, maxEdge, buildFlags); }\ncatch (Exception e) when (e.Message.Contains(\"Multiple outlines\"))\n{ /* raise minRegionArea, lower maxSimplificationError, retry */ }","preventionTips":["Raise minRegionArea to drop tiny fragmented regions.","Lower maxSimplificationError to avoid outline fragmentation.","Tune maxEdgeLength and region partitioning method.","Validate region count after partitioning."],"tags":["recast","contour","region","config"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}