Service#
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.
-
staticmethod UI.add_canvas():
UI.Canvas# Add a new canvas.
Note
If you want to add UI elements to KSPs stock UI canvas, use
UI.stock_canvas.
-
staticmethod UI.message(
content:string,
duration?:number,
position?:UI.MessagePosition,
color?:StdLib.ColorRGBA,
size?:number
)# Display a message on the screen.
- Parameters:
content – Message content.
duration – Duration before the message disappears, in seconds. Defaults to
1.0.position – Position to display the message. Defaults to
UI.MessagePosition.top_center.color – The color of the message. Defaults to
{1.0, 0.92, 0.016, 1.0}.size – Size of the message, differs per position. Defaults to
2e+01.
Note
The message appears just like a stock message, for example quicksave or quickload messages.
-
staticmethod UI.clear(
client_only?:boolean)# Remove all user interface elements.
- Parameters:
client_only – If true, only remove objects created by the calling client. Defaults to
false.