Class LineScrollTextAreaBuilder
Fluent builder for creating and configuring LineScrollTextArea instances at runtime. All configuration methods return the same builder instance, enabling chainable method calls. Call Build() or TryBuild(out LineScrollTextArea) as the terminal step to construct the Unity GameObject and obtain the component.
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
public sealed class LineScrollTextAreaBuilder
Remarks
LineScrollTextArea is a terminal-style, line-by-line scrolling text display that advances content in discrete line increments rather than with continuous momentum physics. It is suited for console output, log viewers, and any UI that benefits from exact line-aligned scrolling with keyboard navigation support.
The builder creates a root GameObject with an optional background
Image component and attaches a LineScrollTextArea
MonoBehaviour. The object is automatically assigned to the UI layer. Font
configuration defaults to the ScyllaMono SDF font unless overridden via
WithFont(TMP_FontAsset).
Example usage:
var console = new LineScrollTextAreaBuilder()
.WithParent(panelTransform)
.WithSize(600f, 400f)
.WithFontSize(13f)
.WithTextColor(Color.green)
.WithBackgroundColor(new Color(0f, 0f, 0f, 0.95f))
.WithModernScrollbar()
.WithEdgeBounce(true)
.Build();
console.AppendLine("System ready.");
Methods
AtPosition(float, float)
Sets the anchored position offset of the component.
Declaration
public LineScrollTextAreaBuilder AtPosition(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | Horizontal offset in pixels from the anchor point. |
| float | y | Vertical offset in pixels from the anchor point. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
AtPosition(Vector2)
Sets the anchored position offset of the component.
Declaration
public LineScrollTextAreaBuilder AtPosition(Vector2 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | Pixel offset from the anchor point applied to the |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
Build()
Builds and returns a fully configured LineScrollTextArea component.
Declaration
public LineScrollTextArea Build()
Returns
| Type | Description |
|---|---|
| LineScrollTextArea | The newly created LineScrollTextArea component. Never returns
|
Remarks
Creates a new root GameObject, applies the configured anchor and size,
optionally adds a background Image component (with
raycastTarget set to false), then attaches and configures
a LineScrollTextArea MonoBehaviour. The object is assigned
to the UI layer. If no explicit font was set, the ScyllaMono SDF font is
loaded via FontUtil.LoadDefaultMonoSDF.
TryBuild(out LineScrollTextArea)
Attempts to build the LineScrollTextArea component, suppressing any exception and reporting failure through the return value instead.
Declaration
public bool TryBuild(out LineScrollTextArea textArea)
Parameters
| Type | Name | Description |
|---|---|---|
| LineScrollTextArea | textArea | When this method returns |
Returns
| Type | Description |
|---|---|
| bool |
|
UseDefaultMonoFont()
Reverts the font selection to the default ScyllaMono SDF monospace font. This is the default behavior when no explicit font has been set.
Declaration
public LineScrollTextAreaBuilder UseDefaultMonoFont()
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithAnchor(UIAlignment)
Sets the anchor and pivot configuration for the component's RectTransform
by deriving a UIAnchor from the specified alignment.
Declaration
public LineScrollTextAreaBuilder WithAnchor(UIAlignment alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| UIAlignment | alignment | A UIAlignment value representing one of the nine standard anchor positions. Internally resolved via FromAlignment(UIAlignment). |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithAnchor(UIAnchor)
Sets the anchor and pivot configuration for the component's RectTransform
using an explicit UIAnchor value.
Declaration
public LineScrollTextAreaBuilder WithAnchor(UIAnchor anchor)
Parameters
| Type | Name | Description |
|---|---|---|
| UIAnchor | anchor | The UIAnchor describing |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithAutoScroll(bool)
Controls whether the component automatically advances the visible window to show the latest line when new content is appended.
Declaration
public LineScrollTextAreaBuilder WithAutoScroll(bool enabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled |
|
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithBackground(bool, Color?)
Enables or disables the background Image component added to the
root GameObject, and optionally sets its color.
Declaration
public LineScrollTextAreaBuilder WithBackground(bool enabled, Color? color = null)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled |
|
| Color? | color | Optional background color. When provided, sets the background color. When
|
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithBackgroundColor(Color)
Sets the background color and implicitly enables the background.
Declaration
public LineScrollTextAreaBuilder WithBackgroundColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The RGBA color applied to the background |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithBackgroundSprite(Sprite)
Sets a custom sliced sprite used as the background and implicitly enables the background.
Declaration
public LineScrollTextAreaBuilder WithBackgroundSprite(Sprite sprite)
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | sprite | The |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithBufferCapacity(int)
Sets the maximum number of logical lines the text buffer retains. When the buffer is full the oldest lines are discarded as new lines are appended.
Declaration
public LineScrollTextAreaBuilder WithBufferCapacity(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capacity | The maximum line count, clamped to the range [MIN_CAPACITY, MAX_CAPACITY]. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithClassicScrollbar(Color, Color, float)
Configures a classic always-visible scrollbar with a visible track and no auto-hide behavior. Implicitly enables the scrollbar.
Declaration
public LineScrollTextAreaBuilder WithClassicScrollbar(Color thumbColor, Color trackColor, float width = 10)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | thumbColor | The RGBA color of the thumb indicator. |
| Color | trackColor | The RGBA color of the background track. |
| float | width | The scrollbar width in pixels. Clamped to a minimum of 1 pixel. Defaults to 10 pixels. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithEdgeBounce(bool)
Enables or disables the edge bounce visual effect. When enabled, a brief animation plays when scrolling reaches the top or bottom boundary, providing tactile feedback that no more content exists in that direction.
Declaration
public LineScrollTextAreaBuilder WithEdgeBounce(bool enabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled |
|
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithEventPublishing(bool)
Enables or disables publishing of scroll and content events via the Scylla event system (SEX).
Declaration
public LineScrollTextAreaBuilder WithEventPublishing(bool enabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled |
|
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithFont(TMP_FontAsset)
Sets the TMP font asset used to render text content in the scroll area. Calling this method with a non-null value disables the default monospace font fallback.
Declaration
public LineScrollTextAreaBuilder WithFont(TMP_FontAsset font)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_FontAsset | font | The |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithFontSize(float)
Sets the font size in points for text rendered in the scroll area.
Declaration
public LineScrollTextAreaBuilder WithFontSize(float size)
Parameters
| Type | Name | Description |
|---|---|---|
| float | size | The desired font size, clamped to the range [MIN_FONT_SIZE, MAX_FONT_SIZE] (1 to 500 points). |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithModernScrollbar(Color?)
Configures a modern minimal scrollbar style similar to iOS and macOS, using a semi-transparent white thumb, an invisible track, and auto-hide. Implicitly enables the scrollbar.
Declaration
public LineScrollTextAreaBuilder WithModernScrollbar(Color? thumbColor = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Color? | thumbColor | Optional custom thumb color. When |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithName(string)
Sets the name of the created root GameObject.
Declaration
public LineScrollTextAreaBuilder WithName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name to assign. When |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithPadding(float)
Sets the uniform padding between the component border and the text content area.
Declaration
public LineScrollTextAreaBuilder WithPadding(float padding)
Parameters
| Type | Name | Description |
|---|---|---|
| float | padding | The padding in pixels applied equally on all sides. Clamped to a minimum
of |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithParent(Transform)
Sets the parent transform that the component's GameObject will be attached to.
Declaration
public LineScrollTextAreaBuilder WithParent(Transform parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parent | The parent transform. Pass |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithScrollInitialDelay(float)
Sets the delay in seconds after a scroll key is first pressed before key-repeat behavior begins.
Declaration
public LineScrollTextAreaBuilder WithScrollInitialDelay(float delay)
Parameters
| Type | Name | Description |
|---|---|---|
| float | delay | The initial delay in seconds. Clamped to a minimum of |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithScrollRepeatInterval(float)
Sets the interval in seconds between successive line advances while a scroll key is held down.
Declaration
public LineScrollTextAreaBuilder WithScrollRepeatInterval(float interval)
Parameters
| Type | Name | Description |
|---|---|---|
| float | interval | The repeat interval in seconds. Clamped to a minimum of 0.01 seconds. Smaller values scroll more lines per second. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithScrollTiming(float, float)
Configures both scroll key-repeat timing parameters in a single call.
Declaration
public LineScrollTextAreaBuilder WithScrollTiming(float initialDelay, float repeatInterval)
Parameters
| Type | Name | Description |
|---|---|---|
| float | initialDelay | Time in seconds after the key is first pressed before key-repeat begins.
Clamped to a minimum of |
| float | repeatInterval | Time in seconds between successive line advances while the key is held. Clamped to a minimum of 0.01 seconds. Defaults to DEFAULT_SCROLL_REPEAT_INTERVAL. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithScrollbar(bool)
Enables or disables the scrollbar indicator overlaid on the right side of the component.
Declaration
public LineScrollTextAreaBuilder WithScrollbar(bool enabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled |
|
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithScrollbarAutoHide(bool, float, float)
Configures the scrollbar auto-hide behavior.
Declaration
public LineScrollTextAreaBuilder WithScrollbarAutoHide(bool autoHide = true, float delay = 1, float fadeDuration = 0.3)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | autoHide |
|
| float | delay | Idle time in seconds before the fade animation begins. Clamped to a
minimum of |
| float | fadeDuration | Duration of the fade-out animation in seconds. Clamped to a minimum of 0.01 seconds. Defaults to 0.3 seconds. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithScrollbarColors(Color, Color?)
Sets both the scrollbar thumb and track colors in a single call and implicitly enables the scrollbar.
Declaration
public LineScrollTextAreaBuilder WithScrollbarColors(Color thumbColor, Color? trackColor = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | thumbColor | The RGBA color of the thumb indicator. |
| Color? | trackColor | Optional RGBA color of the track. When |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithScrollbarThumbColor(Color)
Sets the scrollbar thumb color and implicitly enables the scrollbar.
Declaration
public LineScrollTextAreaBuilder WithScrollbarThumbColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The RGBA color of the draggable thumb indicator. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithScrollbarTrackColor(Color)
Sets the scrollbar track color and implicitly enables the scrollbar. Use an alpha value of zero for a completely invisible track.
Declaration
public LineScrollTextAreaBuilder WithScrollbarTrackColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The RGBA color of the background track behind the thumb. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithScrollbarWidth(float)
Sets the scrollbar width in pixels.
Declaration
public LineScrollTextAreaBuilder WithScrollbarWidth(float width)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The scrollbar width in pixels. Clamped to a minimum of 1 pixel. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
WithSelection(bool)
Enables or disables pointer-driven text line selection.
Declaration
public LineScrollTextAreaBuilder WithSelection(bool enabled = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled |
|
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithSelectionColor(Color)
Sets the highlight color used for the selection overlay and implicitly enables selection.
Declaration
public LineScrollTextAreaBuilder WithSelectionColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The RGBA highlight color drawn behind selected lines. Defaults to semi-transparent blue (0.2, 0.4, 0.8, 0.5). |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithSize(float, float)
Sets the explicit width and height of the component's RectTransform.
Declaration
public LineScrollTextAreaBuilder WithSize(float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | Width in pixels. Clamped to a minimum of 10 pixels. |
| float | height | Height in pixels. Clamped to a minimum of 10 pixels. |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithSize(Vector2)
Sets the explicit width and height of the component's RectTransform.
Declaration
public LineScrollTextAreaBuilder WithSize(Vector2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | size | A |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |
See Also
WithTextColor(Color)
Sets the color of all text rendered in the scroll area.
Declaration
public LineScrollTextAreaBuilder WithTextColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The RGBA color applied to the text. Defaults to |
Returns
| Type | Description |
|---|---|
| LineScrollTextAreaBuilder | This builder instance, enabling fluent method chaining. |