Skip to content

Extensions

Valk edited this page Aug 27, 2025 · 9 revisions

Note

Not all extensions on this page may be up to date. Only a select few highlighted extensions are shown here. For the full list click here.


AnimationTree Extensions

void SetCondition(this AnimationTree tree, StringName path, bool value)
void SetBlendSpace1DPosition(this AnimationTree tree, StringName name, float value)
void SetParam(this AnimationTree tree, StringName path, Variant value)

Variant GetParam(this AnimationTree tree, StringName path)
bool GetCondition(this AnimationTree tree, StringName path)
AnimationNodeStateMachinePlayback GetStateMachine(this AnimationTree tree)

Camera2D Extensions

void SetPositionIgnoreSmoothing(this Camera2D camera, Vector2 position)

Control Extensions

Control SetFontSize(this Control control, int fontSize)
Control SetMarginLeft(this Control control, int padding)
// and so on...

InputEventMouseButton Extensions

bool IsWheelUp(this InputEventMouseButton @event)
bool IsZoomIn(this InputEventMouseButton @event)
bool IsLeftClickPressed(this InputEventMouseButton @event)
bool IsRightClickJustReleased(this InputEventMouseButton @event)
// and so on...

Math Extensions

float Remap(this float value, float from1, float to1, float from2, float to2)

Node Extensions

// Prints results with GD.Print()
node.PrintFormatted(); // Prints node without crashing the editor!!! Amazing!
array.PrintFormatted();

// .ToFormattedString() may be desired if you don't want to use GD.Print()
Game.Log(node.ToFormattedString());
Game.Log(array.ToFormattedString());

T GetAutoload<T>(this Node node, string autoload) where T : Node
T GetSceneNode<T>(this Node node, string path) where T : Node
T GetNode<T>(this Node node, bool recursive = true) where T : Node

void AddToCurrentSceneDeferred(this Node node, Node child)
void AddToCurrentScene(this Node node, Node child)
void AddChildDeferred(this Node node, Node child)
void QueueFreeChildren(this Node parentNode)
void TraverseNodes(this Node node, Action<Node> code)

Node GetNodeInCurrentScene(this Node node, string path)
Node GetCurrentScene(this Node node)

List<Node> GetNodes(this Node node, Type type)
List<T> GetChildren<T>(this Node node, bool recursive = true) where T : Node

bool TryGetNode<T>(this Node node, out T foundNode, bool recursive = true) where T : Node
bool HasNode<T>(this Node node, bool recursive = true) where T : Node

Task WaitOneFrame(this Node parent)

Sprite2D Extensions

Vector2 size = sprite.GetPixelSize();
Clone this wiki locally