UI

class UI

Provides functionality for drawing and interacting with in-game user interface elements.

Canvas StockCanvas { get; }

The stock UI canvas.

Game Scenes:

All

Canvas AddCanvas ()

Add a new canvas.

Game Scenes:

All

Note

If you want to add UI elements to KSPs stock UI canvas, use UI.StockCanvas.

void Message (String content, Single duration = 1.0f, MessagePosition position = 1, Tuple<Double, Double, Double> color = { 1.0, 0.92, 0.016 }, Single size = 20.0f)

Display a message on the screen.

Parameters:
  • content – Message content.

  • duration – Duration before the message disappears, in seconds.

  • position – Position to display the message.

  • color – The color of the message.

  • size – Size of the message, differs per position.

Game Scenes:

All

Note

The message appears just like a stock message, for example quicksave or quickload messages.

void Clear (Boolean clientOnly = false)

Remove all user interface elements.

Parameters:
  • clientOnly – If true, only remove objects created by the calling client.

Game Scenes:

All

enum MessagePosition

Message position.

TopLeft

Top left.

TopCenter

Top center.

TopRight

Top right.

BottomCenter

Bottom center.