Work in progress

Godot documentation is being updated to reflect the latest changes in version 4.0. Some documentation pages may still state outdated information. This banner will tell you if you're reading one of such pages.

The contents of this page are up to date. If you can still find outdated information, please open an issue.

@GlobalScopeΒΆ

Global scope constants and functions.

DescriptionΒΆ

A list of global scope enumerated constants and built-in functions. This is all that resides in the globals, constants regarding error codes, keycodes, property hints, etc.

Singletons are also documented here, since they can be accessed from anywhere.

For the entries related to GDScript which can be accessed in any script see @GDScript.

TutorialsΒΆ

PropertiesΒΆ

AudioServer

AudioServer

CameraServer

CameraServer

ClassDB

ClassDB

DisplayServer

DisplayServer

Engine

Engine

EngineDebugger

EngineDebugger

GDExtensionManager

GDExtensionManager

Geometry2D

Geometry2D

Geometry3D

Geometry3D

GodotSharp

GodotSharp

IP

IP

Input

Input

InputMap

InputMap

JavaClassWrapper

JavaClassWrapper

JavaScriptBridge

JavaScriptBridge

Marshalls

Marshalls

NavigationMeshGenerator

NavigationMeshGenerator

NavigationServer2D

NavigationServer2D

NavigationServer3D

NavigationServer3D

OS

OS

Performance

Performance

PhysicsServer2D

PhysicsServer2D

PhysicsServer2DManager

PhysicsServer2DManager

PhysicsServer3D

PhysicsServer3D

PhysicsServer3DManager

PhysicsServer3DManager

ProjectSettings

ProjectSettings

RenderingServer

RenderingServer

ResourceLoader

ResourceLoader

ResourceSaver

ResourceSaver

ResourceUID

ResourceUID

TextServerManager

TextServerManager

ThemeDB

ThemeDB

Time

Time

TranslationServer

TranslationServer

WorkerThreadPool

WorkerThreadPool

XRServer

XRServer

MethodsΒΆ

Variant

abs ( Variant x )

float

absf ( float x )

int

absi ( int x )

float

acos ( float x )

float

asin ( float x )

float

atan ( float x )

float

atan2 ( float y, float x )

float

bezier_derivative ( float start, float control_1, float control_2, float end, float t )

float

bezier_interpolate ( float start, float control_1, float control_2, float end, float t )

Variant

bytes_to_var ( PackedByteArray bytes )

Variant

bytes_to_var_with_objects ( PackedByteArray bytes )

Variant

ceil ( Variant x )

float

ceilf ( float x )

int

ceili ( float x )

Variant

clamp ( Variant value, Variant min, Variant max )

float

clampf ( float value, float min, float max )

int

clampi ( int value, int min, int max )

float

cos ( float angle_rad )

float

cosh ( float x )

float

cubic_interpolate ( float from, float to, float pre, float post, float weight )

float

cubic_interpolate_angle ( float from, float to, float pre, float post, float weight )

float

cubic_interpolate_angle_in_time ( float from, float to, float pre, float post, float weight, float to_t, float pre_t, float post_t )

float

cubic_interpolate_in_time ( float from, float to, float pre, float post, float weight, float to_t, float pre_t, float post_t )

float

db_to_linear ( float db )

float

deg_to_rad ( float deg )

float

ease ( float x, float curve )

String

error_string ( int error )

float

exp ( float x )

Variant

floor ( Variant x )

float

floorf ( float x )

int

floori ( float x )

float

fmod ( float x, float y )

float

fposmod ( float x, float y )

int

hash ( Variant variable )

Object

instance_from_id ( int instance_id )

float

inverse_lerp ( float from, float to, float weight )

bool

is_equal_approx ( float a, float b )

bool

is_finite ( float x )

bool

is_inf ( float x )

bool

is_instance_id_valid ( int id )

bool

is_instance_valid ( Variant instance )

bool

is_nan ( float x )

bool

is_same ( Variant a, Variant b )

bool

is_zero_approx ( float x )

Variant

lerp ( Variant from, Variant to, Variant weight )

float

lerp_angle ( float from, float to, float weight )

float

lerpf ( float from, float to, float weight )

float

linear_to_db ( float lin )

float

log ( float x )

Variant

max ( ... ) vararg

float

maxf ( float a, float b )

int

maxi ( int a, int b )

Variant

min ( ... ) vararg

float

minf ( float a, float b )

int

mini ( int a, int b )

float

move_toward ( float from, float to, float delta )

int

nearest_po2 ( int value )

float

pingpong ( float value, float length )

int

posmod ( int x, int y )

float

pow ( float base, float exp )

void

print ( ... ) vararg

void

print_rich ( ... ) vararg

void

print_verbose ( ... ) vararg

void

printerr ( ... ) vararg

void

printraw ( ... ) vararg

void

prints ( ... ) vararg

void

printt ( ... ) vararg

void

push_error ( ... ) vararg

void

push_warning ( ... ) vararg

float

rad_to_deg ( float rad )

PackedInt64Array

rand_from_seed ( int seed )

float

randf ( )

float

randf_range ( float from, float to )

float

randfn ( float mean, float deviation )

int

randi ( )

int

randi_range ( int from, int to )

void

randomize ( )

float

remap ( float value, float istart, float istop, float ostart, float ostop )

int

rid_allocate_id ( )

RID

rid_from_int64 ( int base )

Variant

round ( Variant x )

float

roundf ( float x )

int

roundi ( float x )

void

seed ( int base )

Variant

sign ( Variant x )

float

signf ( float x )

int

signi ( int x )

float

sin ( float angle_rad )

float

sinh ( float x )

float

smoothstep ( float from, float to, float x )

Variant

snapped ( Variant x, Variant step )

float

snappedf ( float x, float step )

int

snappedi ( float x, int step )

float

sqrt ( float x )

int

step_decimals ( float x )

String

str ( ... ) vararg

Variant

str_to_var ( String string )

float

tan ( float angle_rad )

float

tanh ( float x )

int

typeof ( Variant variable )

PackedByteArray

var_to_bytes ( Variant variable )

PackedByteArray

var_to_bytes_with_objects ( Variant variable )

String

var_to_str ( Variant variable )

Variant

weakref ( Variant obj )

Variant

wrap ( Variant value, Variant min, Variant max )

float

wrapf ( float value, float min, float max )

int

wrapi ( int value, int min, int max )


EnumerationsΒΆ

enum Side:

Side SIDE_LEFT = 0

Left side, usually used for Control or StyleBox-derived classes.

Side SIDE_TOP = 1

Top side, usually used for Control or StyleBox-derived classes.

Side SIDE_RIGHT = 2

Right side, usually used for Control or StyleBox-derived classes.

Side SIDE_BOTTOM = 3

Bottom side, usually used for Control or StyleBox-derived classes.


enum Corner:

Corner CORNER_TOP_LEFT = 0

Top-left corner.

Corner CORNER_TOP_RIGHT = 1

Top-right corner.

Corner CORNER_BOTTOM_RIGHT = 2

Bottom-right corner.

Corner CORNER_BOTTOM_LEFT = 3

Bottom-left corner.


enum Orientation:

Orientation VERTICAL = 1

General vertical alignment, usually used for Separator, ScrollBar, Slider, etc.

Orientation HORIZONTAL = 0

General horizontal alignment, usually used for Separator, ScrollBar, Slider, etc.


enum ClockDirection:

ClockDirection CLOCKWISE = 0

Clockwise rotation. Used by some methods (e.g. Image.rotate_90).

ClockDirection COUNTERCLOCKWISE = 1

Counter-clockwise rotation. Used by some methods (e.g. Image.rotate_90).


enum HorizontalAlignment:

HorizontalAlignment HORIZONTAL_ALIGNMENT_LEFT = 0

Horizontal left alignment, usually for text-derived classes.

HorizontalAlignment HORIZONTAL_ALIGNMENT_CENTER = 1

Horizontal center alignment, usually for text-derived classes.

HorizontalAlignment HORIZONTAL_ALIGNMENT_RIGHT = 2

Horizontal right alignment, usually for text-derived classes.

HorizontalAlignment HORIZONTAL_ALIGNMENT_FILL = 3

Expand row to fit width, usually for text-derived classes.


enum VerticalAlignment:

VerticalAlignment VERTICAL_ALIGNMENT_TOP = 0

Vertical top alignment, usually for text-derived classes.

VerticalAlignment VERTICAL_ALIGNMENT_CENTER = 1

Vertical center alignment, usually for text-derived classes.

VerticalAlignment VERTICAL_ALIGNMENT_BOTTOM = 2

Vertical bottom alignment, usually for text-derived classes.

VerticalAlignment VERTICAL_ALIGNMENT_FILL = 3

Expand rows to fit height, usually for text-derived classes.


enum InlineAlignment:

InlineAlignment INLINE_ALIGNMENT_TOP_TO = 0

Aligns the top of the inline object (e.g. image, table) to the position of the text specified by INLINE_ALIGNMENT_TO_* constant.

InlineAlignment INLINE_ALIGNMENT_CENTER_TO = 1

Aligns the center of the inline object (e.g. image, table) to the position of the text specified by INLINE_ALIGNMENT_TO_* constant.

InlineAlignment INLINE_ALIGNMENT_BASELINE_TO = 3

Aligns the baseline (user defined) of the inline object (e.g. image, table) to the position of the text specified by INLINE_ALIGNMENT_TO_* constant.

InlineAlignment INLINE_ALIGNMENT_BOTTOM_TO = 2

Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by INLINE_ALIGNMENT_TO_* constant.

InlineAlignment INLINE_ALIGNMENT_TO_TOP = 0

Aligns the position of the inline object (e.g. image, table) specified by INLINE_ALIGNMENT_*_TO constant to the top of the text.

InlineAlignment INLINE_ALIGNMENT_TO_CENTER = 4

Aligns the position of the inline object (e.g. image, table) specified by INLINE_ALIGNMENT_*_TO constant to the center of the text.

InlineAlignment INLINE_ALIGNMENT_TO_BASELINE = 8

Aligns the position of the inline object (e.g. image, table) specified by INLINE_ALIGNMENT_*_TO constant to the baseline of the text.

InlineAlignment INLINE_ALIGNMENT_TO_BOTTOM = 12

Aligns inline object (e.g. image, table) to the bottom of the text.

InlineAlignment INLINE_ALIGNMENT_TOP = 0

Aligns top of the inline object (e.g. image, table) to the top of the text. Equivalent to INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP.

InlineAlignment INLINE_ALIGNMENT_CENTER = 5

Aligns center of the inline object (e.g. image, table) to the center of the text. Equivalent to INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER.

InlineAlignment INLINE_ALIGNMENT_BOTTOM = 14

Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equivalent to INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM.

InlineAlignment INLINE_ALIGNMENT_IMAGE_MASK = 3

A bit mask for INLINE_ALIGNMENT_*_TO alignment constants.

InlineAlignment INLINE_ALIGNMENT_TEXT_MASK = 12

A bit mask for INLINE_ALIGNMENT_TO_* alignment constants.


enum EulerOrder:

EulerOrder EULER_ORDER_XYZ = 0

Specifies that Euler angles should be in XYZ order. When composing, the order is X, Y, Z. When decomposing, the order is reversed, first Z, then Y, and X last.

EulerOrder EULER_ORDER_XZY = 1

Specifies that Euler angles should be in XZY order. When composing, the order is X, Z, Y. When decomposing, the order is reversed, first Y, then Z, and X last.

EulerOrder EULER_ORDER_YXZ = 2

Specifies that Euler angles should be in YXZ order. When composing, the order is Y, X, Z. When decomposing, the order is reversed, first Z, then X, and Y last.

EulerOrder EULER_ORDER_YZX = 3

Specifies that Euler angles should be in YZX order. When composing, the order is Y, Z, X. When decomposing, the order is reversed, first X, then Z, and Y last.

EulerOrder EULER_ORDER_ZXY = 4

Specifies that Euler angles should be in ZXY order. When composing, the order is Z, X, Y. When decomposing, the order is reversed, first Y, then X, and Z last.

EulerOrder EULER_ORDER_ZYX = 5

Specifies that Euler angles should be in ZYX order. When composing, the order is Z, Y, X. When decomposing, the order is reversed, first X, then Y, and Z last.


enum Key:

Key KEY_NONE = 0

Enum value which doesn't correspond to any key. This is used to initialize Key properties with a generic state.

Key KEY_SPECIAL = 4194304

Keycodes with this bit applied are non-printable.

Key KEY_ESCAPE = 4194305

Escape key.

Key KEY_TAB = 4194306

Tab key.

Key KEY_BACKTAB = 4194307

Shift + Tab key.

Key KEY_BACKSPACE = 4194308

Backspace key.

Key KEY_ENTER = 4194309

Return key (on the main keyboard).

Key KEY_KP_ENTER = 4194310

Enter key on the numeric keypad.

Key KEY_INSERT = 4194311

Insert key.

Key KEY_DELETE = 4194312

Delete key.

Key KEY_PAUSE = 4194313

Pause key.

Key KEY_PRINT = 4194314

Print Screen key.

Key KEY_SYSREQ = 4194315

System Request key.

Key KEY_CLEAR = 4194316

Clear key.

Key KEY_HOME = 4194317

Home key.

Key KEY_END = 4194318

End key.

Key KEY_LEFT = 4194319

Left arrow key.

Key KEY_UP = 4194320

Up arrow key.

Key KEY_RIGHT = 4194321

Right arrow key.

Key KEY_DOWN = 4194322

Down arrow key.

Key KEY_PAGEUP = 4194323

Page Up key.

Key KEY_PAGEDOWN = 4194324

Page Down key.

Key KEY_SHIFT = 4194325

Shift key.

Key KEY_CTRL = 4194326

Control key.

Key KEY_META = 4194327

Meta key.

Key KEY_ALT = 4194328

Alt key.

Key KEY_CAPSLOCK = 4194329

Caps Lock key.

Key KEY_NUMLOCK = 4194330

Num Lock key.

Key KEY_SCROLLLOCK = 4194331

Scroll Lock key.

Key KEY_F1 = 4194332

F1 key.

Key KEY_F2 = 4194333

F2 key.

Key KEY_F3 = 4194334

F3 key.

Key KEY_F4 = 4194335

F4 key.