Class TextModeDebugConsoleDisplay
TextMode-based implementation of Scylla.Console.IDebugConsoleDisplay. Thin adapter that wraps a TextModeTerminal and adds Console-specific concerns: gradient background, layout anchoring, console height calculation, and IDebugConsoleDisplay interface adaptation.
Inherited Members
Namespace: Scylla.Console.TextMode
Assembly: ScyllaTextMode.ConsoleDisplay.dll
Syntax
public sealed class TextModeDebugConsoleDisplay : IDebugConsoleDisplay, IDisposable
Constructors
TextModeDebugConsoleDisplay(RectTransform, DebugConsoleSettings, DebugConsoleColorScheme, UIFontReference, ConsoleCommandHistory, CLIAutoComplete)
Creates a new TextModeDebugConsoleDisplay.
Declaration
public TextModeDebugConsoleDisplay(RectTransform parentTransform, DebugConsoleSettings settings, DebugConsoleColorScheme colors, UIFontReference font, ConsoleCommandHistory commandHistory, CLIAutoComplete autoComplete)
Parameters
| Type | Name | Description |
|---|---|---|
| RectTransform | parentTransform | The parent transform to attach the display to. |
| DebugConsoleSettings | settings | The debug console settings. |
| DebugConsoleColorScheme | colors | The colors resolved from the active console theme palette. |
| UIFontReference | font | Optional font reference for the console text. |
| ConsoleCommandHistory | commandHistory | The command history for CLI navigation. Pass null if CLI is disabled. |
| CLIAutoComplete | autoComplete | The auto-complete handler for CLI. Pass null if CLI is disabled. |
Properties
CLIContainer
Gets the CLI container GameObject, if the backend represents the CLI as a distinct child object rather than as part of a larger composite view.
Declaration
public GameObject CLIContainer { get; }
Property Value
| Type | Description |
|---|---|
| GameObject | The GameObject hosting the CLI input field, or |
Remarks
TextMode renders the CLI as part of the grid (bottom row) with no separate container GameObject. Returns null; CLI visibility is controlled through CLIInteractable and terminal settings instead.
CLIInteractable
Gets or sets whether the CLI input field accepts input.
Declaration
public bool CLIInteractable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
CLIIsFocused
Gets whether the CLI input field currently has keyboard focus.
Declaration
public bool CLIIsFocused { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
CLIText
Gets or sets the CLI input text, that is, the command the player has typed so far.
Declaration
public string CLIText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The current input field contents, or an empty string when the CLI does not exist yet (before Scylla.Console.IDebugConsoleDisplay.Initialize(), or when the CLI is disabled). Setting the value replaces the input field contents; setting it before the CLI exists is a no-op. |
ConsoleHeight
Gets the current console height in canvas units, measured from the aligned screen edge to the far side of the console.
Declaration
public float ConsoleHeight { get; }
Property Value
| Type | Description |
|---|---|
| float | The height last computed by Scylla.Console.IDebugConsoleDisplay.UpdateLayout(), in the same units as the enclosing canvas. The value reflects the active Scylla.Console.DebugConsoleSizeMode and, on backends with a fixed cell grid, may be snapped to a whole number of rows. |
HasSelection
Gets whether any text is currently selected.
Declaration
public bool HasSelection { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
MaxScrollPosition
Gets the maximum scroll position in pixels, that is, how far the log can be scrolled before it reaches the newest content.
Declaration
public float MaxScrollPosition { get; }
Property Value
| Type | Description |
|---|---|
| float | The pixel distance between the top and bottom of the full log content, or |
RootObject
Gets the root GameObject of the display, which parents every visual element the backend creates (background, log area, and CLI input field where applicable).
Declaration
public GameObject RootObject { get; }
Property Value
| Type | Description |
|---|---|
| GameObject | The root GameObject created by Scylla.Console.IDebugConsoleDisplay.Initialize(), or |
RootTransform
Gets the root RectTransform of the display, used by the console to anchor and resize the whole display as one unit.
Declaration
public RectTransform RootTransform { get; }
Property Value
| Type | Description |
|---|---|
| RectTransform | The RectTransform on Scylla.Console.IDebugConsoleDisplay.RootObject, or |
ScrollPosition
Gets the current scroll position in pixels, measured from the top (oldest content) of the log.
Declaration
public float ScrollPosition { get; }
Property Value
| Type | Description |
|---|---|
| float |
|
SupportsTextAttributes
Gets whether this backend renders the console's text attribute markup.
Declaration
public bool SupportsTextAttributes { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
Backends that report false never see the markup: the console strips it
before calling AppendLine(string, Color32), so a passage marked for inverse video is
simply rendered normally. false is therefore the safe answer, and the right
one for any backend that has no concept of per-character styling.
See Also
ViewportHeight
Gets the viewport height in pixels, that is, how much of the log is visible at once.
Declaration
public float ViewportHeight { get; }
Property Value
| Type | Description |
|---|---|
| float | The height, in pixels, of the area the log text is rendered into. |
Methods
AppendLine(string, Color32)
Appends a line of text with a specific color to the log display.
Declaration
public void AppendLine(string text, Color32 color)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The plain text to append (no TMP tags). Carries the markup described by
Scylla.Console.ConsoleTextMarkup only when Scylla.Console.IDebugConsoleDisplay.SupportsTextAttributes is
|
| Color32 | color | The foreground color for the text. |
ApplyScrollVelocity(float)
Applies a velocity to the scroll physics for momentum scrolling, so a fast flick or key release keeps the log moving briefly rather than stopping dead.
Declaration
public void ApplyScrollVelocity(float velocity)
Parameters
| Type | Name | Description |
|---|---|---|
| float | velocity | The velocity in pixels per second. Positive scrolls toward the newest content. |
Remarks
Not every backend has real momentum physics. A backend without it converts the velocity into a single discrete jump instead of a decelerating scroll; see the remarks on the concrete implementation in use.
CLIClear()
Clears the CLI input field.
Declaration
public void CLIClear()
CLIFocus()
Focuses the CLI input field.
Declaration
public void CLIFocus()
CLIProcessInput()
Processes CLI input (history navigation, auto-complete, etc.).
Declaration
public void CLIProcessInput()
CLIUnfocus()
Unfocuses the CLI input field.
Declaration
public void CLIUnfocus()
Clear()
Clears all text from the log display.
Declaration
public void Clear()
CopySelectionToClipboard()
Copies the current selection to the system clipboard.
Declaration
public void CopySelectionToClipboard()
Destroy()
Destroys the display and releases all resources it created in Scylla.Console.IDebugConsoleDisplay.Initialize(), including the root GameObject and any component-level state.
Declaration
public void Destroy()
Remarks
Safe to call from Dispose(); every implementation forwards
its Dispose to this method. After this call, Scylla.Console.IDebugConsoleDisplay.RootObject and
Scylla.Console.IDebugConsoleDisplay.RootTransform return null again.
Dispose()
Declaration
public void Dispose()
HandleDrag(Vector2)
Handles an ongoing drag gesture, moving the log in response to pointer movement.
Declaration
public void HandleDrag(Vector2 screenPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | screenPosition | The current screen position of the drag. |
Remarks
Drag-to-scroll is an optional capability. A backend that does not support it treats this call as a no-op; see the remarks on the concrete implementation in use.
HandleDragEnd(Vector2)
Handles the end of a drag gesture, typically releasing any residual scroll velocity as momentum.
Declaration
public void HandleDragEnd(Vector2 screenPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | screenPosition | The screen position of the drag end. |
Remarks
Drag-to-scroll is an optional capability. A backend that does not support it treats this call as a no-op; see the remarks on the concrete implementation in use.
HandleDragStart(Vector2)
Handles the start of a drag gesture, so the display can begin tracking a click-and-drag scroll.
Declaration
public void HandleDragStart(Vector2 screenPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | screenPosition | The screen position of the drag start. |
Remarks
Drag-to-scroll is an optional capability. A backend that does not support it treats this call as a no-op; see the remarks on the concrete implementation in use.
HandleSelectionInput(Vector2, bool, bool, bool, bool)
Handles selection input for the current frame: a held modifier key plus a click-and-drag gesture selects text line by line.
Declaration
public bool HandleSelectionInput(Vector2 mousePos, bool pressed, bool justPressed, bool justReleased, bool modHeld)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | mousePos | The current mouse position, in screen space. |
| bool | pressed | Whether the mouse button is currently held down. |
| bool | justPressed | Whether the mouse button was pressed this frame. |
| bool | justReleased | Whether the mouse button was released this frame. |
| bool | modHeld | Whether the selection modifier key is currently held. |
Returns
| Type | Description |
|---|---|
| bool |
|
Initialize()
Initializes the display and creates all visual elements: the root GameObject, the background, the log area, and, when the CLI is enabled, the input field.
Declaration
public void Initialize()
Remarks
Must be called exactly once before any other member of this interface is used,
and before the corresponding accessor properties (Scylla.Console.IDebugConsoleDisplay.RootObject,
Scylla.Console.IDebugConsoleDisplay.RootTransform) return anything other than null. Pair with
Scylla.Console.IDebugConsoleDisplay.Destroy() when the display is torn down.
Paste(string)
Pastes text into the command line at its cursor.
Declaration
public void Paste(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to paste, usually the system clipboard's. |
Remarks
A display whose command line is a text field that pastes by itself does nothing here, so the same key press does not paste twice. The default implementation does nothing as well, so a display written before this member existed still compiles.
PopScreen()
Closes the open screen and gives the console its log back.
Declaration
public bool PopScreen()
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Called automatically once a screen reports IsFinished, and when the console is hidden or destroyed with one still open, so a screen cannot strand the console in a state with no command line. Safe to call at any time.
See Also
PushScreen(IConsoleScreen)
Hands the console's grid to a full-screen view until it finishes.
Declaration
public bool PushScreen(IConsoleScreen screen)
Parameters
| Type | Name | Description |
|---|---|---|
| IConsoleScreen | screen | The screen to open. Ignored when |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Opening a screen switches the terminal to its alternate grid, so the log and the scroll position are set aside rather than overwritten and come back untouched when the screen closes. The command line is unfocused and stops reading input for as long as the screen is open.
Only one screen runs at a time. There is no stack: a second push while one is open is refused rather than layered, because a screen owns every cell and two of them would draw over each other.
See Also
ScrollBy(float)
Scrolls by a relative amount in pixels.
Declaration
public void ScrollBy(float pixels)
Parameters
| Type | Name | Description |
|---|---|---|
| float | pixels | The pixel amount to scroll. |
ScrollTo(float, bool)
Scrolls to a specific position.
Declaration
public void ScrollTo(float position, bool animated)
Parameters
| Type | Name | Description |
|---|---|---|
| float | position | The target scroll position in pixels. |
| bool | animated | Whether to animate the scroll. |
Remarks
Not every backend can animate a scroll or land on an arbitrary pixel position.
Backends that scroll a whole line at a time round position to
the nearest line and may ignore animated entirely; see the
remarks on the concrete implementation in use.
ScrollToBottom(bool)
Scrolls to the bottom (newest content).
Declaration
public void ScrollToBottom(bool animated)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | animated | Whether to animate the scroll. |
Remarks
Backends without a scroll animation ignore animated and jump
straight to the bottom; see the remarks on the concrete implementation in use.
ScrollToTop(bool)
Scrolls to the top (oldest content).
Declaration
public void ScrollToTop(bool animated)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | animated | Whether to animate the scroll. |
Remarks
Backends without a scroll animation ignore animated and jump
straight to the top; see the remarks on the concrete implementation in use.
SelectAll()
Selects all text in the log display.
Declaration
public void SelectAll()
SetVisible(bool)
Sets the visibility of the display.
Declaration
public void SetVisible(bool visible)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | visible | Whether the display should be visible. |
Update(float)
Updates the display. Called every frame while the console is visible, so that backends whose animation or input handling is not driven by Unity's own component lifecycle still get a chance to advance.
Declaration
public void Update(float deltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | deltaTime | The time in seconds since the last frame. |
Remarks
A backend built entirely out of MonoBehaviour components that already tick themselves through Unity's normal update loop can leave this as a no-op; not every implementation needs this hook to do real work.
UpdateFont(UIFontReference)
Updates the font used by the display.
Declaration
public void UpdateFont(UIFontReference font)
Parameters
| Type | Name | Description |
|---|---|---|
| UIFontReference | font | The new font reference. |
UpdateLayout()
Updates the layout based on current screen size and settings.
Declaration
public void UpdateLayout()
UpdateSettings(DebugConsoleSettings, DebugConsoleColorScheme, UIFontReference)
Updates the display with new settings, colors and optional font.
Declaration
public void UpdateSettings(DebugConsoleSettings settings, DebugConsoleColorScheme colors, UIFontReference font)
Parameters
| Type | Name | Description |
|---|---|---|
| DebugConsoleSettings | settings | The new settings. |
| DebugConsoleColorScheme | colors | The colors resolved from the active console theme palette. |
| UIFontReference | font | Optional new font reference. |
Events
OnCommandSubmitted
Fired when a command is submitted via the CLI, typically by pressing Enter. The argument is the raw input text exactly as typed, before any command parsing.
Declaration
public event Action<string> OnCommandSubmitted
Event Type
| Type | Description |
|---|---|
| Action<string> |
OnEscapePressed
Fired when the user presses Escape while the CLI input field has focus, which the console interprets as a request to close or unfocus.
Declaration
public event Action OnEscapePressed
Event Type
| Type | Description |
|---|---|
| Action |