UI#
Provides functionality for drawing and interacting with in-game user interface elements.
Note
For drawing 3D objects in the flight scene, see the Drawing service. User interface elements created by a client are removed when that client disconnects, and when the game scene changes. A client that needs its interface in more than one scene must create it again in each of them.
- stock_canvas: UI.Canvas#
The stock UI canvas.
- Attribute:
Read-only, cannot be set
- Return type:
- static add_canvas()#
Add a new canvas.
- Return type:
Note
If you want to add UI elements to KSPs stock UI canvas, use
UI.stock_canvas.
- static message(content[, duration = 1.0][, position = UI.MessagePosition.top_center][, color = {1.0, 0.92, 0.016, 1.0}][, size = 2e+01])#
Display a message on the screen.
- Parameters:
content (
string) – Message content.duration (
number) – Duration before the message disappears, in seconds.position (
UI.MessagePosition) – Position to display the message.color (
StdLib.ColorRGBA) – The color of the message.size (
number) – Size of the message, differs per position.
Note
The message appears just like a stock message, for example quicksave or quickload messages.
- static clear([client_only = false])#
Remove all user interface elements.
- Parameters:
client_only (
boolean) – If true, only remove objects created by the calling client.