The console is shown pressing F1:
The console is useful to interact with the engine in many ways. Type /help to show a list of basic commands or /keys to show the current keys for moving the character controller and interact with the world.
The console API can be accessed through the static method VoxelPlayUI.instance.
The console is really split in 2 areas: the scrollable text area that shows all messages and the status bar.
To add a message to the status bar/console:
using VoxelPlay; public class MyScript : MonoBehaviour { void Start() { VoxelPlayUI.instance.AddMessage(“Hello World!”); } }
Console Events
The following events are exposed by the console:
Triggered when a new message is printed to the console public event OnConsoleEvent OnConsoleNewMessage; Triggered whhen a new command is entered by the user public event OnConsoleEvent OnConsoleNewCommand;
Console Methods
Shows/hides the console public void ToggleConsoleVisibility (bool state) Adds a custom text to the console public void AddConsoleText (string text) Adds a custom message to the status bar and to the console public void AddMessage (string text) Hides the status bar public void HideStatusText()
Inventory Methods
Shows/hides the inventory public void ToggleInventoryVisibility (bool state) Redraws contents of inventory public void RefreshInventoryContents () Shows currently selected item public void ShowSelectedItem (InventoryItem inventoryItem) Hides the selected item public void HideSelectedItem()
Events
/// Triggered when a new message is added to the console
public event OnConsoleEvent OnConsoleNewMessage;
public event OnConsoleEvent OnConsoleNewCommand;
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article