Skip to content

TextStudio3DMaterialRegionRegistry

ClassTextStudio.ThreeDTextStudio.3D
public sealed class TextStudio3DMaterialRegionRegistry

Per-renderer, per-build registry for semantic regions emitted by custom geometry modules. Built-in region values remain stable at 0-8; custom values are assigned deterministically from registration order beginning at 9.

Register(string, string, Material, MaterialRegion, TextStudioSurfaceMask)

Section titled “Register(string, string, Material, MaterialRegion, TextStudioSurfaceMask)”
public MaterialRegion Register(string id, string displayName, Material material = null, MaterialRegion fallbackRegion = MaterialRegion.Decoration, TextStudioSurfaceMask surfaceMask = TextStudioSurfaceMask.Decorations)

Registers or finds a provider-owned semantic region. Re-registering the same ID returns its existing region, allowing cooperating callbacks to share one stable slot.

Parameters

Name Type
id System.String
displayName System.String
material UnityEngine.Material
fallbackRegion TextStudio.ThreeD.MaterialRegion
surfaceMask TextStudio.TextStudioSurfaceMask

Returns

TextStudio.ThreeD.MaterialRegion

public bool TryGetRegion(string id, out MaterialRegion region)

Finds a custom region by its stable provider-owned ID.

Parameters

Name Type
id System.String
region TextStudio.ThreeD.MaterialRegion

Returns

System.Boolean

public void EnsureRegionCapacity(ref GlyphMeshData mesh)

Expands a glyph’s region table so it can receive registered custom ranges.

Parameters

Name Type
mesh TextStudio.ThreeD.GlyphMeshData

AssignRange(ref GlyphMeshData, MaterialRegion, int, int)

Section titled “AssignRange(ref GlyphMeshData, MaterialRegion, int, int)”
public void AssignRange(ref GlyphMeshData mesh, MaterialRegion region, int start, int count)

Assigns a contiguous triangle range to a built-in or registered region. The mesh’s index buffer remains provider-owned; this method validates and expands only the semantic table.

Parameters

Name Type
mesh TextStudio.ThreeD.GlyphMeshData
region TextStudio.ThreeD.MaterialRegion
start System.Int32
count System.Int32

public TextStudio3DMaterialRegionRegistry()

public int Count { get; }

Total built-in and custom region slots in the current build.

Returns

System.Int32

public int CustomCount { get; }

Number of custom regions in the current build.

Returns

System.Int32

public IReadOnlyList<TextStudio3DMaterialRegionDefinition> Definitions { get; }

Registered custom definitions in deterministic slot order.

Returns

System.Collections.Generic.IReadOnlyList{TextStudio.ThreeD.TextStudio3DMaterialRegionDefinition}