Class UITextFactory
Factory for creating IUIText instances backed by TextMeshProUGUI.
Isolates consumers from direct TMP API dependencies so the underlying rendering
component can be swapped without changing call sites.
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
public static class UITextFactory
Remarks
All factory methods return the IUIText interface rather than a
concrete TMP type. Call Wrap(TextMeshProUGUI) to adapt an existing
TextMeshProUGUI component to the same interface.
Methods
CreateForPerformanceMonitor(Transform, string, int, UIFontReference)
Creates a new UI text component optimized for performance monitor displays.
The text stretches to fill its parent rect (anchors 0,0 to 1,1, offsets all zero),
uses top-left alignment, no word wrap, and has raycastTarget disabled
for performance.
Declaration
public static IUIText CreateForPerformanceMonitor(Transform parent, string name, int fontSize, UIFontReference font = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parent | The parent transform under which the new GameObject is created. |
| string | name | The name for the new GameObject. Falls back to |
| int | fontSize | The font size in points. |
| UIFontReference | font | Optional font reference. When |
Returns
| Type | Description |
|---|---|
| IUIText | A new IUIText instance wrapping the configured |
Remarks
Font selection follows this priority chain:
- The font specified by
font(if non-null and has a font asset). - The Scylla Stats SDF font loaded by Scylla.Core.Util.UI.UITextFactory.GetPerformanceMonitorFont().
- The default Scylla monospace SDF font loaded by
FontUtil.LoadDefaultMonoSDF.
Wrap(TextMeshProUGUI)
Adapts an existing TextMeshProUGUI component to the IUIText
interface without creating a new GameObject. Useful when a TextMeshProUGUI
is already present in the scene or prefab and needs to be consumed via the
abstraction layer.
Declaration
public static IUIText Wrap(TextMeshProUGUI tmpText)
Parameters
| Type | Name | Description |
|---|---|---|
| TextMeshProUGUI | tmpText | The existing TMP text component to wrap. |
Returns
| Type | Description |
|---|---|
| IUIText | An IUIText instance that delegates all calls to |