Category: Core

Brief Description

Built-in GDScript functions.

Member Functions

Color Color8 ( int r8, int g8, int b8, int a8 )
Color ColorN ( String name, float alpha )
float abs ( float s )
float acos ( float s )
float asin ( float s )
Nil assert ( bool condition )
float atan ( float s )
float atan2 ( float x, float y )
Variant bytes2var ( RawArray bytes )
float ceil ( float s )
float clamp ( float val, float min, float max )
Object convert ( Variant what, int type )
float cos ( float s )
float cosh ( float s )
float db2linear ( float db )
float decimals ( float step )
float dectime ( float value, float amount, float step )
float deg2rad ( float deg )
Object dict2inst ( Dictionary dict )
float ease ( float s, float curve )
float exp ( float s )
float floor ( float s )
float fmod ( float x, float y )
float fposmod ( float x, float y )
FuncRef funcref ( Object instance, String funcname )
int hash ( Variant var:Variant )
Dictionary inst2dict ( Object inst )
Object instance_from_id ( int instance_id )
float is_inf ( float s )
float is_nan ( float s )
float lerp ( float from, float to, float weight )
float linear2db ( float nrg )
Resource load ( String path )
float log ( float s )
float max ( float a, float b )
float min ( float a, float b )
int nearest_po2 ( int val )
float pow ( float x, float y )
Resource preload ( String path )
Nil print ( Variant what, Variant)
Nil print_stack ( )
Nil printerr ( Variant what, Variant)
Nil printraw ( Variant what, Variant)
Nil prints ( Variant what, Variant)
Nil printt ( Variant what, Variant)
float rad2deg ( float rad )
float rand_range ( float from, float to )
Array rand_seed ( int seed )
float randf ( )
int randi ( )
Nil randomize ( )
Array range ( Variant)
float round ( float s )
Nil seed ( int seed )
float sign ( float s )
float sin ( float s )
float sinh ( float s )
float sqrt ( float s )
float stepify ( float s, float step )
String str ( Variant what, Variant)
Variant str2var ( String string )
float tan ( float s )
float tanh ( float s )
bool type_exists ( String type )
int typeof ( Variant what )
RawArray var2bytes ( Variant var )
String var2str ( Variant var )
WeakRef weakref ( Object obj )
GDFunctionState yield ( Object object, String signal )

Numeric Constants

  • PI = 3.141593 — Constant that represents how many times the diameter of a circumference fits around its perimeter.


This contains the list of built-in gdscript functions. Mostly math functions and other utilities. Everything else is expanded by objects.

Member Function Description

Make a color from red, green, blue and alpha. Arguments can range from 0 to 255.

Remove sign (works for integer and float).



Assert that the condition is true. If the condition is false, generates an error.


Arc-tangent that takes a 2D vector as argument, returns the full -pi to +pi range.

Decode a byte array back to a value.

Ceiling (rounds up to nearest integer).

Clamp both values to a range.

Convert from a type to another in the best way possible. The “type” parameter uses the enum TYPE_* in @Global Scope.

Standard cosine function.

Hyperbolic cosine.

Convert from decibels to linear energy (audio).

Return the amount of decimals in the floating point value.

Decreases time by a specified amount.

Convert from degrees to radians.

Convert a previously converted instances to dictionary back into an instance. Useful for deserializing.

Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.

Exponential logarithm.

Floor (rounds down to nearest integer).

Module (remainder of x/y).

Module (remainder of x/y) that wraps equally in positive and negative.

Return a reference to the specified function.

Hash the variable passed and return an integer.

Convert a script class instance to a dictionary (useful for serializing).

  • Object instance_from_id ( int instance_id )

Get an object by its ID.

Linear interpolates between two values by a normalized value.

Convert from linear energy to decibels (audio).

Load a resource from the filesystem, pass a valid path as argument.

Natural logarithm.

Return the maximum of two values.

Return the minimum of two values.

Return the nearest larger power of 2 for an integer.

Power function, x elevate to y.

Preload a resource from the filesystem. The resource is loaded during script parsing.

Print one or more arguments to strings in the best way possible to a console line.

  • Nil print_stack ( )

Print a stack track at code location, only works when running with debugger turned on.

Print one or more arguments to strings in the best way possible to standard error line.

Print one or more arguments to strings in the best way possible to console. No newline is added at the end.

Print one or more arguments to the console with a space between each argument.

Print one or more arguments to the console with a tab between each argument.

Convert from radians to degrees.

Random range, any floating point value between ‘from’ and ‘to’

Random from seed, pass a seed and an array with both number and new seed is returned.

Random value (0 to 1 float).

  • int randi ( )

Random 32 bits value (integer). To obtain a value from 0 to N, you can use remainder, like (for random from 0 to 19): randi() % 20.

  • Nil randomize ( )

Reset the seed of the random number generator with a new, different one.

Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial, final-1, increment).

Round to nearest integer.

Set seed for the random number generator.

Return sign (-1 or +1).

Standard sine function.

Hyperbolic sine.

Square root.

Snap float value to a given step.

Convert one or more arguments to strings in the best way possible.

Convert a formatted string that was returned by var2str to the original value.

Standard tangent function.

Hyperbolic tangent.

Return the internal type of the given Variant object, using the TYPE_* enum in @Global Scope.

Encode a variable value to a byte array.

Convert a value to a formatted string that can later be parsed using str2var.

Return a weak reference to an object.

Stop the function execution and return the current state. Call GDFunctionState.resume on the state to resume execution. This invalidates the state.

Returns anything that was passed to the resume function call. If passed an object and a signal, the execution is resumed when the object’s signal is emmited.