Class ScyllaUIText
Content-aware text wrapper that exposes a TMP_Text component's auto-size pipeline
through a Scylla-flavored API. Configures the underlying TMP_Text's
enableAutoSizing / fontSizeMin / fontSizeMax from a single
component, so designers don't need to remember the TMP knobs and Scylla can
coordinate sizes across siblings via ScyllaUITextGroup.
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
[AddComponentMenu("Scylla/UI/Layout/Text")]
[DisallowMultipleComponent]
[ExecuteAlways]
public sealed class ScyllaUIText : MonoBehaviour
Remarks
The underlying TMP_Text reference is resolved via GetComponent<T> and cached. When no TMP_Text component is present the wrapper still stores its settings; the actual TMP integration is a no-op until a TMP_Text is attached. This keeps the component test-friendly and avoids hard-failing layouts that add the wrapper before swapping in a TMP target.
Auto-size in TMP is a multi-pass operation - TMP iterates layout to find the
largest font size that fits within the configured bounds. Use auto-size where
content varies (button labels, dynamic strings); leave fixed UI text at a
static fontSize to avoid the per-frame cost.
Like ScyllaUIScreenMargin, the first Apply() is
deferred to LateUpdate so touching TMP from OnEnable in
EditMode batch test setups does not race the editor environment.
Properties
CurrentFontSize
Current TMP-reported font size. Reads TMP_Text.fontSize, which reflects
the size TMP chose after auto-size resolution. Returns 0 when no
TMP_Text is attached.
Declaration
public float CurrentFontSize { get; }
Property Value
| Type | Description |
|---|---|
| float |
EnableAutoSize
Enable TMP auto-size on the underlying TMP_Text.
Declaration
public bool EnableAutoSize { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MaxFontSize
Maximum font size in points (used as fontSizeMax when auto-sizing).
Declaration
public float MaxFontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MinFontSize
Minimum font size in points (used as fontSizeMin when auto-sizing).
Declaration
public float MinFontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
TMP
Cached TMP_Text reference, resolved via GetComponent<T>
on first access. null when no TMP_Text component is attached to this
GameObject.
Declaration
public TMP_Text TMP { get; }
Property Value
| Type | Description |
|---|---|
| TMP_Text |
Methods
Apply()
Pushes the wrapper's settings into the underlying TMP_Text. No-op when no TMP_Text is attached. Safe to call from any context.
Declaration
public void Apply()
OverrideFontSize(float)
Directly overrides the TMP font size, bypassing auto-size. Used by ScyllaUITextGroup when broadcasting a synchronized size to group members. Disables auto-size as a side effect to keep TMP from re-fitting to its own bounds after the override.
Declaration
public void OverrideFontSize(float fontSize)
Parameters
| Type | Name | Description |
|---|---|---|
| float | fontSize | Target font size in points. |