UI & Console API
advanced scriptingVoxel Play 3 · Scripting / API
Overview
The console is accessible by pressing F1. It enables interaction with the engine in various ways. Users can type /help to view basic commands or /keys to display current controls for character movement and world interaction.
The console API is accessed through VoxelPlayUI.instance. The console comprises two sections: a scrollable text area displaying all messages and a status bar.
Adding Messages to Console
using VoxelPlay;
public class MyScript : MonoBehaviour {
void Start() {
VoxelPlayUI.instance.AddMessage("Hello World!");
}
}
Console Events
OnConsoleNewMessage- Triggered when a new message is printed to the consoleOnConsoleNewCommand- Triggered when a new command is entered by the user
Console Methods
IsConsoleVisible- Returns true if the console is visibleToggleConsoleVisibility(bool state)- Shows/hides the consoleAddConsoleText(string text)- Adds custom text to the consoleAddMessage(string text, float displayTime = 4f, bool flash = true, bool openConsole = false)- Adds custom message to status bar and consoleHideStatusText()- Hides the status bar
Inventory Methods
IsInventoryVisible- Returns true if the inventory is visibleToggleInventoryVisibility(bool state)- Shows/hides inventoryInventoryNextPage()- Advances to next inventory pageInventoryPreviousPage()- Shows previous inventory pageRefreshInventoryContents()- Redraws inventory contentsShowSelectedItem(InventoryItem inventoryItem)- Shows currently selected itemHideSelectedItem()- Hides the selected item
Other Methods
ToggleInitializationPanel(bool visible, string text = "", float progress = 0)- Shows/hides loading panelToggleDebugWindow(bool visible)- Shows/hides debug window
Was this page helpful?
Suggest an improvement
Help us improve this documentation page.