public static abstract sealed class Editor.Application
Related Guides
Broader workflow and conceptual references connected to this API.
If you are using HTTP requests or WebSockets in your game, you can use Auth Tokens to validate that the requests were sent from a valid Steam user in a s&box game session. This is useful if you want to tie data to a specific Steam account, or prevent botting.
When creating a Tool or Editor Project, it's common to want to be able to trigger certain actions with a key press or combined keystroke (Like O to enter Object Mode, or SHIFT+B to enter the Block Tool).
Whenever you save a code file in your project (.cs or .razor files), we recompile and attempt to live-reload the changed assembly. This lets you quickly iterate and see your changes without needing to restart the editor. Ideally we want to support this for 99% of code changes without you needing to think about what happens under the hood, but this document will help you investigate cases where things go wrong.
Methods
Showing 4 methods
public static bool IsKeyDown(Editor.KeyCode code)
Returns whether or not a key is currently being held down.
public static string KeyCodeToString(Editor.KeyCode code)
Converts an editor keycode to a string used by the game Qt::Key -> WindowsVirtualKey -> ButtonCode_t -> string
public static void SetStyles(string style)
public static void Spin()
Will process all of the UI events - allowing the UI to stay responsive during a blocking call.
No results match this filter.
Properties
Showing 11 properties
public static Vector2 Editor.Application.CursorDelta { get; set; }
The cursor delta between this and previous frame.
public static Vector2 Editor.Application.CursorPosition { get; set; }
Get/Set cursor position.
public static float Editor.Application.DpiScale { get; set; }
public static Editor.EditorSystem Editor.Application.Editor { get; set; }
Get the current editor if any. Will return null if we're not in the editor, or there is no active editor session.
public static Editor.Widget Editor.Application.FocusWidget { get; set; }
The `Editor.Widget` that has the keyboard input focus, or `null`if no widget in this application has the focus.
public static Editor.Widget Editor.Application.HoveredWidget { get; set; }
The Widget that is currently hovered
public static Sandbox.KeyboardModifiers Editor.Application.KeyboardModifiers { get; set; }
Returns which keyboard modified keys are held down right at this point.
public static Sandbox.MouseButtons Editor.Application.MouseButtons { get; set; }
Returns the current state of the mouse buttons.
public static Vector2 Editor.Application.MouseWheelDelta { get; set; }
The mouse wheel delta between this and previous frame
public static System.Action`2<Editor.Widget,Editor.MouseEvent> Editor.Application.OnWidgetClicked { get; set; }
Called when any widget is clicked. Can set MouseEvent.Accepted to true to prevent the Widget's OnMouseClick from firing.
public static Vector2 Editor.Application.UnscaledCursorPosition { get; set; }
The cursor position, not scaled for DPI
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Editor |
| Type | class |
| Assembly | Sandbox.Tools |
| Doc ID | T:Editor.Application |