diff --git a/Assets/Scripts/Components/MeshPainter/MeshPainter.Backend.cs b/Assets/Scripts/Components/MeshPainter/MeshPainter.Backend.cs index 4de395b..74db91d 100644 --- a/Assets/Scripts/Components/MeshPainter/MeshPainter.Backend.cs +++ b/Assets/Scripts/Components/MeshPainter/MeshPainter.Backend.cs @@ -93,7 +93,12 @@ public partial class MeshPainter // Material slots per map, as pre-hashed IDs (this runs per stroke end - no per-call allocations). // MSO: one mask map drives three URP slots: _MetallicGlossMap (R/A) + _OcclusionMap (G) + // _ParallaxMap (G = occlusion reused as a 0.5-centred height for parallax/relief). - private static readonly int[][] MapPropIds = + // Built lazily on first use (runtime): the *Id fields live in the MeshPainter.cs partial and the + // static field-initializer order ACROSS partial files is unspecified - a plain field initializer + // here can run first and capture 0 for every id, so HasProperty(0) fails and no map ever binds + // (white defaults -> full-glossy + emissive). Deferring to first access sidesteps that ordering. + private static int[][] _mapPropIds; + private static int[][] MapPropIds => _mapPropIds ??= new[] { new[] { BaseMapId, MainTexId }, // MAP_ALBEDO new[] { MetallicGlossMapId, OcclusionMapId, ParallaxMapId }, // MAP_MSO