Global scope constants and functions.
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].
$DOCS_URL/tutorials/math/random_number_generation.html
Returns the absolute value of a [Variant] parameter [param x] (i.e. non-negative value). Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported.
[codeblock]
var a = abs(-1)
# a is 1
var b = abs(-1.2)
# b is 1.2
var c = abs(Vector2(-3.5, -4))
# c is (3.5, 4)
var d = abs(Vector2i(-5, -6))
# d is (5, 6)
var e = abs(Vector3(-7, 8.5, -3.8))
# e is (7, 8.5, 3.8)
var f = abs(Vector3i(-7, -8, -9))
# f is (7, 8, 9)
[/codeblock]
Returns the absolute value of float parameter [param x] (i.e. positive value).
[codeblock]
# a is 1.2
var a = absf(-1.2)
[/codeblock]
Returns the absolute value of int parameter [param x] (i.e. positive value).
[codeblock]
# a is 1
var a = absi(-1)
[/codeblock]
Returns the arc cosine of [param x] in radians. Use to get the angle of cosine [param x]. [param x] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method acos] will return [constant @GDScript.NAN].
[codeblock]
# c is 0.523599 or 30 degrees if converted with rad_to_deg(c)
var c = acos(0.866025)
[/codeblock]
Returns the arc sine of [param x] in radians. Use to get the angle of sine [param x]. [param x] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method asin] will return [constant @GDScript.NAN].
[codeblock]
# s is 0.523599 or 30 degrees if converted with rad_to_deg(s)
var s = asin(0.5)
[/codeblock]
Returns the arc tangent of [param x] in radians. Use it to get the angle from an angle's tangent in trigonometry.
The method cannot know in which quadrant the angle should fall. See [method atan2] if you have both [code]y[/code] and [code]x[/code].
[codeblock]
var a = atan(0.5) # a is 0.463648
[/codeblock]
If [param x] is between [code]-PI / 2[/code] and [code]PI / 2[/code] (inclusive), [code]atan(tan(x))[/code] is equal to [param x].
Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant.
Important note: The Y coordinate comes first, by convention.
[codeblock]
var a = atan2(0, -1) # a is 3.141593
[/codeblock]
Returns the point at the given [param t] on a one-dimnesional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points.
Decodes a byte array back to a [Variant] value, without decoding objects.
[b]Note:[/b] If you need object deserialization, see [method bytes_to_var_with_objects].
Decodes a byte array back to a [Variant] value. Decoding objects is allowed.
[b]Warning:[/b] Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution).
Rounds [param x] upward (towards positive infinity), returning the smallest whole number that is not less than [param x]. Supported types: [int], [float], [Vector2], [Vector3], [Vector4].
[codeblock]
var i = ceil(1.45) # i is 2.0
i = ceil(1.001) # i is 2.0
[/codeblock]
See also [method floor], [method round], and [method snapped].
[b]Note:[/b] For better type safety, you can use [method ceilf], [method ceili], [method Vector2.ceil], [method Vector3.ceil] or [method Vector4.ceil] instead.
Rounds [param x] upward (towards positive infinity), returning the smallest whole number that is not less than [param x].
A type-safe version of [method ceil], specialzied in floats.
Rounds [param x] upward (towards positive infinity), returning the smallest whole number that is not less than [param x].
A type-safe version of [method ceil] that returns integer.
Clamps the [Variant] [param value] and returns a value not less than [param min] and not more than [param max]. Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported.
[codeblock]
var a = clamp(-10, -1, 5)
# a is -1
var b = clamp(8.1, 0.9, 5.5)
# b is 5.5
var c = clamp(Vector2(-3.5, -4), Vector2(-3.2, -2), Vector2(2, 6.5))
# c is (-3.2, -2)
var d = clamp(Vector2i(7, 8), Vector2i(-3, -2), Vector2i(2, 6))
# d is (2, 6)
var e = clamp(Vector3(-7, 8.5, -3.8), Vector3(-3, -2, 5.4), Vector3(-2, 6, -4.1))
# e is (-3, -2, 5.4)
var f = clamp(Vector3i(-7, -8, -9), Vector3i(-1, 2, 3), Vector3i(-4, -5, -6))
# f is (-4, -5, -6)
[/codeblock]
Clamps the float [param value] and returns a value not less than [param min] and not more than [param max].
[codeblock]
var speed = 42.1
# a is 20.0
var a = clampf(speed, 1.0, 20.0)
speed = -10.0
# a is -1.0
a = clampf(speed, -1.0, 1.0)
[/codeblock]
Clamps the integer [param value] and returns a value not less than [param min] and not more than [param max].
[codeblock]
var speed = 42
# a is 20
var a = clampi(speed, 1, 20)
speed = -10
# a is -1
a = clampi(speed, -1, 1)
[/codeblock]
Returns the cosine of angle [param angle_rad] in radians.
[codeblock]
cos(PI * 2) # Returns 1.0
cos(PI) # Returns -1.0
cos(deg_to_rad(90)) # Returns 0.0
[/codeblock]
Returns the hyperbolic cosine of [param x] in radians.
[codeblock]
# Prints 1.543081
print(cosh(1))
[/codeblock]
Cubic interpolates between two values by the factor defined in [param weight] with pre and post values.
Cubic interpolates between two rotation values with shortest path by the factor defined in [param weight] with pre and post values. See also [method lerp_angle].
Cubic interpolates between two rotation values with shortest path by the factor defined in [param weight] with pre and post values. See also [method lerp_angle].
It can perform smoother interpolation than [code]cubic_interpolate()[/code] by the time values.
Cubic interpolates between two values by the factor defined in [param weight] with pre and post values.
It can perform smoother interpolation than [code]cubic_interpolate()[/code] by the time values.
Converts from decibels to linear energy (audio).
Converts an angle expressed in degrees to radians.
[codeblock]
# r is 3.141593
var r = deg_to_rad(180)
[/codeblock]
Returns an "eased" value of [param x] based on an easing function defined with [param curve]. This easing function is based on an exponent. The [param curve] can be any floating-point number, with specific values leading to the following behaviors:
[codeblock]
- Lower than -1.0 (exclusive): Ease in-out
- 1.0: Linear
- Between -1.0 and 0.0 (exclusive): Ease out-in
- 0.0: Constant
- Between 0.0 to 1.0 (exclusive): Ease out
- 1.0: Linear
- Greater than 1.0 (exclusive): Ease in
[/codeblock]
[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/ease_cheatsheet.png]ease() curve values cheatsheet[/url]
See also [method smoothstep]. If you need to perform more advanced transitions, use [method Tween.interpolate_value].
Returns a human-readable name for the given error code.
The natural exponential function. It raises the mathematical constant [b]e[/b] to the power of [param x] and returns it.
[b]e[/b] has an approximate value of 2.71828, and can be obtained with [code]exp(1)[/code].
For exponents to other bases use the method [method pow].
[codeblock]
var a = exp(2) # Approximately 7.39
[/codeblock]
Rounds [param x] downward (towards negative infinity), returning the largest whole number that is not more than [param x]. Supported types: [int], [float], [Vector2], [Vector3], [Vector4].
[codeblock]
# a is 2.0
var a = floor(2.99)
# a is -3.0
a = floor(-2.99)
[/codeblock]
See also [method ceil], [method round], and [method snapped].
[b]Note:[/b] For better type safety, you can use [method floorf], [method floori], [method Vector2.floor], [method Vector3.floor] or [method Vector4.floor] instead.
Rounds [param x] downward (towards negative infinity), returning the largest whole number that is not more than [param x].
A type-safe version of [method floor], specialzied in floats.
Rounds [param x] downward (towards negative infinity), returning the largest whole number that is not more than [param x].
Equivalent of doing [code]int(x)[/code].
Returns the floating-point remainder of [code]x/y[/code], keeping the sign of [param x].
[codeblock]
# Remainder is 1.5
var remainder = fmod(7, 5.5)
[/codeblock]
For the integer remainder operation, use the [code]%[/code] operator.
Returns the floating-point modulus of [code]x/y[/code] that wraps equally in positive and negative.
[codeblock]
for i in 7:
var x = 0.5 * i - 1.5
print("%4.1f %4.1f %4.1f" % [x, fmod(x, 1.5), fposmod(x, 1.5)])
[/codeblock]
Produces:
[codeblock]
-1.5 -0.0 0.0
-1.0 -1.0 0.5
-0.5 -0.5 1.0
0.0 0.0 0.0
0.5 0.5 0.5
1.0 1.0 1.0
1.5 0.0 0.0
[/codeblock]
Returns the integer hash of the variable passed.
[codeblock]
print(hash("a")) # Prints 177670
[/codeblock]
Returns the Object that corresponds to [param instance_id]. All Objects have a unique instance ID.
[codeblock]
var foo = "bar"
func _ready():
var id = get_instance_id()
var inst = instance_from_id(id)
print(inst.foo) # Prints bar
[/codeblock]
Returns an interpolation or extrapolation factor considering the range specified in [param from] and [param to], and the interpolated value specified in [param weight]. The returned value will be between [code]0.0[/code] and [code]1.0[/code] if [param weight] is between [param from] and [param to] (inclusive). If [param weight] is located outside this range, then an extrapolation factor will be returned (return value lower than [code]0.0[/code] or greater than [code]1.0[/code]). Use [method clamp] on the result of [method inverse_lerp] if this is not desired.
[codeblock]
# The interpolation ratio in the `lerp()` call below is 0.75.
var middle = lerp(20, 30, 0.75)
# `middle` is now 27.5.
# Now, we pretend to have forgotten the original ratio and want to get it back.
var ratio = inverse_lerp(20, 30, 27.5)
# `ratio` is now 0.75.
[/codeblock]
See also [method lerp] which performs the reverse of this operation, and [method remap] to map a continuous series of values to another.
Returns [code]true[/code] if [param a] and [param b] are approximately equal to each other.
Here, approximately equal means that [param a] and [param b] are within a small internal epsilon of each other, which scales with the magnitude of the numbers.
Infinity values of the same sign are considered equal.
Returns whether [code]x[/code] is a finite value, i.e. it is not [constant @GDScript.NAN], positive infinity, or negative infinity.
Returns whether [param x] is an infinity value (either positive infinity or negative infinity).
Returns [code]true[/code] if the Object that corresponds to [param id] is a valid object (e.g. has not been deleted from memory). All Objects have a unique instance ID.
Returns whether [param instance] is a valid object (e.g. has not been deleted from memory).
Returns whether [param x] is a NaN ("Not a Number" or invalid) value.
Returns [code]true[/code] if [param x] is zero or almost zero.
This method is faster than using [method is_equal_approx] with one value as zero.
Linearly interpolates between two values by the factor defined in [param weight]. To perform interpolation, [param weight] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i]. Use [method clamp] on the result of [method lerp] if this is not desired.
Both [param from] and [param to] must have matching types. Supported types: [float], [Vector2], [Vector3], [Vector4], [Color], [Quaternion], [Basis].
[codeblock]
lerp(0, 4, 0.75) # Returns 3.0
[/codeblock]
See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep]. See also [method remap] to map a continuous series of values to another.
[b]Note:[/b] For better type safety, you can use [method lerpf], [method Vector2.lerp], [method Vector3.lerp], [method Vector4.lerp], [method Color.lerp], [method Quaternion.slerp] or [method Basis.slerp] instead.
Linearly interpolates between two angles (in radians) by a normalized value.
Similar to [method lerp], but interpolates correctly when the angles wrap around [constant @GDScript.TAU]. To perform eased interpolation with [method lerp_angle], combine it with [method ease] or [method smoothstep].
[codeblock]
extends Sprite
var elapsed = 0.0
func _process(delta):
var min_angle = deg_to_rad(0.0)
var max_angle = deg_to_rad(90.0)
rotation = lerp_angle(min_angle, max_angle, elapsed)
elapsed += delta
[/codeblock]
[b]Note:[/b] This method lerps through the shortest path between [param from] and [param to]. However, when these two angles are approximately [code]PI + k * TAU[/code] apart for any integer [code]k[/code], it's not obvious which way they lerp due to floating-point precision errors. For example, [code]lerp_angle(0, PI, weight)[/code] lerps counter-clockwise, while [code]lerp_angle(0, PI + 5 * TAU, weight)[/code] lerps clockwise.
Linearly interpolates between two values by the factor defined in [param weight]. To perform interpolation, [param weight] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i].
[codeblock]
lerp(0, 4, 0.75) # Returns 3.0
[/codeblock]
See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep].
Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear). Example:
[codeblock]
# "Slider" refers to a node that inherits Range such as HSlider or VSlider.
# Its range must be configured to go from 0 to 1.
# Change the bus name if you'd like to change the volume of a specific bus only.
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db($Slider.value))
[/codeblock]
Natural logarithm. The amount of time needed to reach a certain level of continuous growth.
[b]Note:[/b] This is not the same as the "log" function on most calculators, which uses a base 10 logarithm.
[codeblock]
log(10) # Returns 2.302585
[/codeblock]
[b]Note:[/b] The logarithm of [code]0[/code] returns [code]-inf[/code], while negative values return [code]-nan[/code].
Returns the maximum of the given values. This method can take any number of arguments.
[codeblock]
max(1, 7, 3, -6, 5) # Returns 7
[/codeblock]
Returns the maximum of two float values.
[codeblock]
maxf(3.6, 24) # Returns 24.0
maxf(-3.99, -4) # Returns -3.99
[/codeblock]
Returns the maximum of two int values.
[codeblock]
maxi(1, 2) # Returns 2
maxi(-3, -4) # Returns -3
[/codeblock]
Returns the minimum of the given values. This method can take any number of arguments.
[codeblock]
min(1, 7, 3, -6, 5) # Returns -6
[/codeblock]
Returns the minimum of two float values.
[codeblock]
minf(3.6, 24) # Returns 3.6
minf(-3.99, -4) # Returns -4.0
[/codeblock]
Returns the minimum of two int values.
[codeblock]
mini(1, 2) # Returns 1
mini(-3, -4) # Returns -4
[/codeblock]
Moves [param from] toward [param to] by the [param delta] value.
Use a negative [param delta] value to move away.
[codeblock]
move_toward(5, 10, 4) # Returns 9
move_toward(10, 5, 4) # Returns 6
move_toward(10, 5, -1.5) # Returns 11.5
[/codeblock]
Returns the nearest equal or larger power of 2 for integer [param value].
In other words, returns the smallest value [code]a[/code] where [code]a = pow(2, n)[/code] such that [code]value <= a[/code] for some non-negative integer [code]n[/code].
[codeblock]
nearest_po2(3) # Returns 4
nearest_po2(4) # Returns 4
nearest_po2(5) # Returns 8
nearest_po2(0) # Returns 0 (this may not be what you expect)
nearest_po2(-1) # Returns 0 (this may not be what you expect)
[/codeblock]
[b]Warning:[/b] Due to the way it is implemented, this function returns [code]0[/code] rather than [code]1[/code] for non-positive values of [param value] (in reality, 1 is the smallest integer power of 2).
Returns the [param value] wrapped between [code]0[/code] and the [param length]. If the limit is reached, the next value the function returned is decreased to the [code]0[/code] side or increased to the [param length] side (like a triangle wave). If [param length] is less than zero, it becomes positive.
[codeblock]
pingpong(-3.0, 3.0) # Returns 3
pingpong(-2.0, 3.0) # Returns 2
pingpong(-1.0, 3.0) # Returns 1
pingpong(0.0, 3.0) # Returns 0
pingpong(1.0, 3.0) # Returns 1
pingpong(2.0, 3.0) # Returns 2
pingpong(3.0, 3.0) # Returns 3
pingpong(4.0, 3.0) # Returns 2
pingpong(5.0, 3.0) # Returns 1
pingpong(6.0, 3.0) # Returns 0
[/codeblock]
Returns the integer modulus of [code]x/y[/code] that wraps equally in positive and negative.
[codeblock]
for i in range(-3, 4):
print("%2d %2d %2d" % [i, i % 3, posmod(i, 3)])
[/codeblock]
Produces:
[codeblock]
-3 0 0
-2 -2 1
-1 -1 2
0 0 0
1 1 1
2 2 2
3 0 0
[/codeblock]
Returns the result of [param base] raised to the power of [param exp].
[codeblock]
pow(2, 5) # Returns 32
[/codeblock]
Converts one or more arguments of any type to string in the best way possible and prints them to the console.
[codeblock]
var a = [1, 2, 3]
print("a", "b", a) # Prints ab[1, 2, 3]
[/codeblock]
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
Converts one or more arguments of any type to string in the best way possible and prints them to the console. The following BBCode tags are supported: b, i, u, s, indent, code, url, center, right, color, bgcolor, fgcolor. Color tags only support named colors such as [code]red[/code], [i]not[/i] hexadecimal color codes. Unsupported tags will be left as-is in standard output.
When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Displaying ANSI escape codes is currently only supported on Linux and macOS. Support for ANSI escape codes may vary across terminal emulators, especially for italic and strikethrough.
[codeblock]
print_rich("[code][b]Hello world![/b][/code]") # Prints out: [b]Hello world![/b]
[/codeblock]
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
If verbose mode is enabled ([method OS.is_stdout_verbose] returning [code]true[/code]), converts one or more arguments of any type to string in the best way possible and prints them to the console.
Prints one or more arguments to strings in the best way possible to standard error line.
[codeblock]
printerr("prints to stderr")
[/codeblock]
Prints one or more arguments to strings in the best way possible to console. No newline is added at the end.
[codeblock]
printraw("A")
printraw("B")
# Prints AB
[/codeblock]
[b]Note:[/b] Due to limitations with Godot's built-in console, this only prints to the terminal. If you need to print in the editor, use another method, such as [method print].
Prints one or more arguments to the console with a space between each argument.
[codeblock]
prints("A", "B", "C") # Prints A B C
[/codeblock]
Prints one or more arguments to the console with a tab between each argument.
[codeblock]
printt("A", "B", "C") # Prints A B C
[/codeblock]
Pushes an error message to Godot's built-in debugger and to the OS terminal.
[codeblock]
push_error("test error") # Prints "test error" to debugger and terminal as error call
[/codeblock]
[b]Note:[/b] Errors printed this way will not pause project execution. To print an error message and pause project execution in debug builds, use [code]assert(false, "test error")[/code] instead.
Pushes a warning message to Godot's built-in debugger and to the OS terminal.
[codeblock]
push_warning("test warning") # Prints "test warning" to debugger and terminal as warning call
[/codeblock]
Converts an angle expressed in radians to degrees.
[codeblock]
rad_to_deg(0.523599) # Returns 30
[/codeblock]
Random from seed: pass a [param seed], and an array with both number and new seed is returned. "Seed" here refers to the internal state of the pseudo random number generator. The internal state of the current implementation is 64 bits.
Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive).
[codeblock]
randf() # Returns e.g. 0.375671
[/codeblock]
Returns a random floating point value on the interval between [param from] and [param to] (inclusive).
[codeblock]
prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315
[/codeblock]
Returns a normally-distributed pseudo-random floating point value using Box-Muller transform with the specified [param mean] and a standard [param deviation]. This is also called Gaussian distribution.
Returns a random unsigned 32-bit integer. Use remainder to obtain a random value in the interval [code][0, N - 1][/code] (where N is smaller than 2^32).
[codeblock]
randi() # Returns random integer between 0 and 2^32 - 1
randi() % 20 # Returns random integer between 0 and 19
randi() % 100 # Returns random integer between 0 and 99
randi() % 100 + 1 # Returns random integer between 1 and 100
[/codeblock]
Returns a random signed 32-bit integer between [param from] and [param to] (inclusive). If [param to] is lesser than [param from], they are swapped.
[codeblock]
print(randi_range(0, 1)) # Prints 0 or 1
print(randi_range(-10, 1000)) # Prints any number from -10 to 1000
[/codeblock]
Randomizes the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
[b]Note:[/b] This method is called automatically when the project is run. If you need to fix the seed to have reproducible results, use [method seed] to initialize the random number generator.
Maps a [param value] from range [code][istart, istop][/code] to [code][ostart, ostop][/code]. See also [method lerp] and [method inverse_lerp]. If [param value] is outside [code][istart, istop][/code], then the resulting value will also be outside [code][ostart, ostop][/code]. Use [method clamp] on the result of [method remap] if this is not desired.
[codeblock]
remap(75, 0, 100, -1, 1) # Returns 0.5
[/codeblock]
For complex use cases where you need multiple ranges, consider using [Curve] or [Gradient] instead.
Allocate a unique ID which can be used by the implementation to construct a RID. This is used mainly from native extensions to implement servers.
Create a RID from an int64. This is used mainly from native extensions to build servers.
Rounds [param x] to the nearest whole number, with halfway cases rounded away from zero. Supported types: [int], [float], [Vector2], [Vector3], [Vector4].
[codeblock]
round(2.4) # Returns 2
round(2.5) # Returns 3
round(2.6) # Returns 3
[/codeblock]
See also [method floor], [method ceil], and [method snapped].
[b]Note:[/b] For better type safety, you can use [method roundf], [method roundi], [method Vector2.round], [method Vector3.round] or [method Vector4.round] instead.
Rounds [param x] to the nearest whole number, with halfway cases rounded away from zero.
A type-safe version of [method round], specialzied in floats.
Rounds [param x] to the nearest whole number, with halfway cases rounded away from zero.
A type-safe version of [method round] that returns integer.
Sets seed for the random number generator.
[codeblock]
var my_seed = "Godot Rocks"
seed(my_seed.hash())
[/codeblock]
Returns the sign of [param x] as same type of [Variant] as [param x] with each component being -1, 0 and 1 for each negative, zero and positive values respectivelu. Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported.
[codeblock]
sign(-6.0) # Returns -1
sign(0.0) # Returns 0
sign(6.0) # Returns 1
sign(Vector3(-6.0, 0.0, 6.0) # Returns (-1, 0, 1)
[/codeblock]
Returns the sign of [param x] as a float: -1.0 or 1.0. Returns 0.0 if [param x] is 0.
[codeblock]
sign(-6.0) # Returns -1.0
sign(0.0) # Returns 0.0
sign(6.0) # Returns 1.0
[/codeblock]
Returns the sign of [param x] as an integer: -1 or 1. Returns 0 if [param x] is 0.
[codeblock]
sign(-6) # Returns -1
sign(0) # Returns 0
sign(6) # Returns 1
[/codeblock]
Returns the sine of angle [param angle_rad] in radians.
[codeblock]
sin(0.523599) # Returns 0.5
sin(deg_to_rad(90)) # Returns 1.0
[/codeblock]
Returns the hyperbolic sine of [param x].
[codeblock]
var a = log(2.0) # Returns 0.693147
sinh(a) # Returns 0.75
[/codeblock]
Returns the result of smoothly interpolating the value of [param x] between [code]0[/code] and [code]1[/code], based on the where [param x] lies with respect to the edges [param from] and [param to].
The return value is [code]0[/code] if [code]x <= from[/code], and [code]1[/code] if [code]x >= to[/code]. If [param x] lies between [param from] and [param to], the returned value follows an S-shaped curve that maps [param x] between [code]0[/code] and [code]1[/code].
This S-shaped curve is the cubic Hermite interpolator, given by [code]f(y) = 3*y^2 - 2*y^3[/code] where [code]y = (x-from) / (to-from)[/code].
[codeblock]
smoothstep(0, 2, -5.0) # Returns 0.0
smoothstep(0, 2, 0.5) # Returns 0.15625
smoothstep(0, 2, 1.0) # Returns 0.5
smoothstep(0, 2, 2.0) # Returns 1.0
[/codeblock]
Compared to [method ease] with a curve value of [code]-1.6521[/code], [method smoothstep] returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer].
[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_ease_comparison.png]Comparison between smoothstep() and ease(x, -1.6521) return values[/url]
Snaps float value [param x] to a given [param step]. This can also be used to round a floating point number to an arbitrary number of decimals.
[codeblock]
snapped(100, 32) # Returns 96
snapped(3.14159, 0.01) # Returns 3.14
[/codeblock]
See also [method ceil], [method floor], and [method round].
Returns the square root of [param x], where [param x] is a non-negative number.
[codeblock]
sqrt(9) # Returns 3
[/codeblock]
[b]Note:[/b] Negative values of [param x] return NaN. If you need negative inputs, use [code]System.Numerics.Complex[/code] in C#.
Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation.
[codeblock]
# n is 0
var n = step_decimals(5)
# n is 4
n = step_decimals(1.0005)
# n is 9
n = step_decimals(0.000000005)
[/codeblock]
Converts one or more arguments of any type to string in the best way possible.
Converts a formatted [param string] that was returned by [method var_to_str] to the original value.
[codeblock]
var a = '{ "a": 1, "b": 2 }'
var b = str_to_var(a)
print(b["a"]) # Prints 1
[/codeblock]
Returns the tangent of angle [param angle_rad] in radians.
[codeblock]
tan(deg_to_rad(45)) # Returns 1
[/codeblock]
Returns the hyperbolic tangent of [param x].
[codeblock]
var a = log(2.0) # Returns 0.693147
tanh(a) # Returns 0.6
[/codeblock]
Returns the internal type of the given Variant object, using the [enum Variant.Type] values.
[codeblock]
var json = JSON.new()
json.parse('["a", "b", "c"]')
var result = json.get_data()
if typeof(result) == TYPE_ARRAY:
print(result[0]) # Prints a
else:
print("Unexpected result")
[/codeblock]
Encodes a [Variant] value to a byte array, without encoding objects. Deserialization can be done with [method bytes_to_var].
[b]Note:[/b] If you need object serialization, see [method var_to_bytes_with_objects].
Encodes a [Variant] value to a byte array. Encoding objects is allowed (and can potentially include code). Deserialization can be done with [method bytes_to_var_with_objects].
Converts a Variant [param variable] to a formatted string that can later be parsed using [method str_to_var].
[codeblock]
a = { "a": 1, "b": 2 }
print(var_to_str(a))
[/codeblock]
prints
[codeblock]
{
"a": 1,
"b": 2
}
[/codeblock]
Returns a weak reference to an object, or [code]null[/code] if the argument is invalid.
A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it.
Wraps the [Variant] [param value] between [param min] and [param max].
Usable for creating loop-alike behavior or infinite surfaces.
Variant types [int] and [float] (real) are supported. If any of the argument is [float] the result will be [float], otherwise it is [int].
[codeblock]
var a = wrap(4, 5, 10)
# a is 9 (int)
var a = wrap(7, 5, 10)
# a is 7 (int)
var a = wrap(10.5, 5, 10)
# a is 5.5 (float)
[/codeblock]
Wraps float [param value] between [param min] and [param max].
Usable for creating loop-alike behavior or infinite surfaces.
[codeblock]
# Infinite loop between 5.0 and 9.9
value = wrapf(value + 0.1, 5.0, 10.0)
[/codeblock]
[codeblock]
# Infinite rotation (in radians)
angle = wrapf(angle + 0.1, 0.0, TAU)
[/codeblock]
[codeblock]
# Infinite rotation (in radians)
angle = wrapf(angle + 0.1, -PI, PI)
[/codeblock]
[b]Note:[/b] If [param min] is [code]0[/code], this is equivalent to [method fposmod], so prefer using that instead.
[code]wrapf[/code] is more flexible than using the [method fposmod] approach by giving the user control over the minimum value.
Wraps integer [param value] between [param min] and [param max].
Usable for creating loop-alike behavior or infinite surfaces.
[codeblock]
# Infinite loop between 5 and 9
frame = wrapi(frame + 1, 5, 10)
[/codeblock]
[codeblock]
# result is -2
var result = wrapi(-6, -5, -1)
[/codeblock]
The [AudioServer] singleton.
The [CameraServer] singleton.
The [ClassDB] singleton.
The [DisplayServer] singleton.
The [Engine] singleton.
The [EngineDebugger] singleton.
The [Geometry2D] singleton.
The [Geometry3D] singleton.
The [GodotSharp] singleton.
The [IP] singleton.
The [Input] singleton.
The [InputMap] singleton.
The [JavaClassWrapper] singleton.
[b]Note:[/b] Only implemented on Android.
The [JavaScriptBridge] singleton.
[b]Note:[/b] Only implemented on the Web platform.
The [Marshalls] singleton.
The [NavigationMeshGenerator] singleton.
The [NavigationServer2D] singleton.
The [NavigationServer2D] singleton.
The [OS] singleton.
The [Performance] singleton.
The [PhysicsServer2D] singleton.
The [PhysicsServer2DManager] singleton.
The [PhysicsServer3D] singleton.
The [PhysicsServer3DManager] singleton.
The [ProjectSettings] singleton.
The [RenderingServer] singleton.
The [ResourceLoader] singleton.
The [ResourceSaver] singleton.
The [ResourceUID] singleton.
The [TextServerManager] singleton.
The [ThemeDB] singleton.
The [Time] singleton.
The [TranslationServer] singleton.
The [WorkerThreadPool] singleton.
The [XRServer] singleton.
Left side, usually used for [Control] or [StyleBox]-derived classes.
Top side, usually used for [Control] or [StyleBox]-derived classes.
Right side, usually used for [Control] or [StyleBox]-derived classes.
Bottom side, usually used for [Control] or [StyleBox]-derived classes.
Top-left corner.
Top-right corner.
Bottom-right corner.
Bottom-left corner.
General vertical alignment, usually used for [Separator], [ScrollBar], [Slider], etc.
General horizontal alignment, usually used for [Separator], [ScrollBar], [Slider], etc.
Horizontal left alignment, usually for text-derived classes.
Horizontal center alignment, usually for text-derived classes.
Horizontal right alignment, usually for text-derived classes.
Expand row to fit width, usually for text-derived classes.
Vertical top alignment, usually for text-derived classes.
Vertical center alignment, usually for text-derived classes.
Vertical bottom alignment, usually for text-derived classes.
Expand rows to fit height, usually for text-derived classes.
Aligns the top of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.
Aligns the center of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.
Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.
Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the top of the text.
Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the center of the text.
Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the baseline of the text.
Aligns inline object (e.g. image, table) to the bottom of the text.
Aligns top of the inline object (e.g. image, table) to the top of the text. Equivalent to [code]INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP[/code].
Aligns center of the inline object (e.g. image, table) to the center of the text. Equivalent to [code]INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER[/code].
Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equivalent to [code]INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM[/code].
A bit mask for [code]INLINE_ALIGNMENT_*_TO[/code] alignment constants.
A bit mask for [code]INLINE_ALIGNMENT_TO_*[/code] alignment constants.
Enum value which doesn't correspond to any key. This is used to initialize [enum Key] properties with a generic state.
Keycodes with this bit applied are non-printable.
Escape key.
Tab key.
Shift + Tab key.
Backspace key.
Return key (on the main keyboard).
Enter key on the numeric keypad.
Insert key.
Delete key.
Pause key.
Print Screen key.
System Request key.
Clear key.
Home key.
End key.
Left arrow key.
Up arrow key.
Right arrow key.
Down arrow key.
Page Up key.
Page Down key.
Shift key.
Control key.
Meta key.
Alt key.
Caps Lock key.
Num Lock key.
Scroll Lock key.
F1 key.
F2 key.
F3 key.
F4 key.
F5 key.
F6 key.
F7 key.
F8 key.
F9 key.
F10 key.
F11 key.
F12 key.
F13 key.
F14 key.
F15 key.
F16 key.
F17 key.
F18 key.
F19 key.
F20 key.
F21 key.
F22 key.
F23 key.
F24 key.
F25 key. Only supported on macOS and Linux due to a Windows limitation.
F26 key. Only supported on macOS and Linux due to a Windows limitation.
F27 key. Only supported on macOS and Linux due to a Windows limitation.
F28 key. Only supported on macOS and Linux due to a Windows limitation.
F29 key. Only supported on macOS and Linux due to a Windows limitation.
F30 key. Only supported on macOS and Linux due to a Windows limitation.
F31 key. Only supported on macOS and Linux due to a Windows limitation.
F32 key. Only supported on macOS and Linux due to a Windows limitation.
F33 key. Only supported on macOS and Linux due to a Windows limitation.
F34 key. Only supported on macOS and Linux due to a Windows limitation.
F35 key. Only supported on macOS and Linux due to a Windows limitation.
Multiply (*) key on the numeric keypad.
Divide (/) key on the numeric keypad.
Subtract (-) key on the numeric keypad.
Period (.) key on the numeric keypad.
Add (+) key on the numeric keypad.
Number 0 on the numeric keypad.
Number 1 on the numeric keypad.
Number 2 on the numeric keypad.
Number 3 on the numeric keypad.
Number 4 on the numeric keypad.
Number 5 on the numeric keypad.
Number 6 on the numeric keypad.
Number 7 on the numeric keypad.
Number 8 on the numeric keypad.
Number 9 on the numeric keypad.
Left Super key (Windows key).
Right Super key (Windows key).
Context menu key.
Left Hyper key.
Right Hyper key.
Help key.
Left Direction key.
Right Direction key.
Media back key. Not to be confused with the Back button on an Android device.
Media forward key.
Media stop key.
Media refresh key.
Volume down key.
Mute volume key.
Volume up key.
Bass Boost key.
Bass up key.
Bass down key.
Treble up key.
Treble down key.
Media play key.
Media stop key.
Previous song key.
Next song key.
Media record key.
Home page key.
Favorites key.
Search key.
Standby key.
Open URL / Launch Browser key.
Launch Mail key.
Launch Media key.
Launch Shortcut 0 key.
Launch Shortcut 1 key.
Launch Shortcut 2 key.
Launch Shortcut 3 key.
Launch Shortcut 4 key.
Launch Shortcut 5 key.
Launch Shortcut 6 key.
Launch Shortcut 7 key.
Launch Shortcut 8 key.
Launch Shortcut 9 key.
Launch Shortcut A key.
Launch Shortcut B key.
Launch Shortcut C key.
Launch Shortcut D key.
Launch Shortcut E key.
Launch Shortcut F key.
Unknown key.
Space key.
! key.
" key.
# key.
$ key.
% key.
& key.
' key.
( key.
) key.
* key.
+ key.
, key.
- key.
. key.
/ key.
Number 0.
Number 1.
Number 2.
Number 3.
Number 4.
Number 5.
Number 6.
Number 7.
Number 8.
Number 9.
: key.
; key.
< key.
= key.
> key.
? key.
@ key.
A key.
B key.
C key.
D key.
E key.
F key.
G key.
H key.
I key.
J key.
K key.
L key.
M key.
N key.
O key.
P key.
Q key.
R key.
S key.
T key.
U key.
V key.
W key.
X key.
Y key.
Z key.
[ key.
\ key.
] key.
^ key.
_ key.
` key.
{ key.
| key.
} key.
~ key.
Non-breakable space key.
¡ key.
¢ key.
£ key.
¤ key.
¥ key.
¦ key.
§ key.
¨ key.
© key.
ª key.
« key.
¬ key.
Soft hyphen key.
® key.
¯ key.
° key.
± key.
² key.
³ key.
´ key.
µ key.
¶ key.
· key.
¸ key.
¹ key.
º key.
» key.
¼ key.
½ key.
¾ key.
¿ key.
À key.
Á key.
 key.
à key.
Ä key.
Å key.
Æ key.
Ç key.
È key.
É key.
Ê key.
Ë key.
Ì key.
Í key.
Î key.
Ï key.
Ð key.
Ñ key.
Ò key.
Ó key.
Ô key.
Õ key.
Ö key.
× key.
Ø key.
Ù key.
Ú key.
Û key.
Ü key.
Ý key.
Þ key.
ß key.
÷ key.
ÿ key.
Key Code mask.
Modifier key mask.
Automatically remapped to [constant KEY_META] on macOS and [constant KEY_CTRL] on other platforms, this mask is never set in the actual events, and should be used for key mapping only.
Shift key mask.
Alt or Option (on macOS) key mask.
Command (on macOS) or Meta/Windows key mask.
Ctrl key mask.
Keypad key mask.
Group Switch key mask.
Enum value which doesn't correspond to any mouse button. This is used to initialize [enum MouseButton] properties with a generic state.
Primary mouse button, usually the left button.
Secondary mouse button, usually the right button.
Middle mouse button.
Mouse wheel up.
Mouse wheel down.
Mouse wheel left button (only present on some mice).
Mouse wheel right button (only present on some mice).
Extra mouse button 1 (only present on some mice).
Extra mouse button 2 (only present on some mice).
Primary mouse button mask, usually for the left button.
Secondary mouse button mask, usually for the right button.
Middle mouse button mask.
Extra mouse button 1 mask.
Extra mouse button 2 mask.
An invalid game controller button.
Game controller SDL button A. Corresponds to the bottom action button: Sony Cross, Xbox A, Nintendo B.
Game controller SDL button B. Corresponds to the right action button: Sony Circle, Xbox B, Nintendo A.
Game controller SDL button X. Corresponds to the left action button: Sony Square, Xbox X, Nintendo Y.
Game controller SDL button Y. Corresponds to the top action button: Sony Triangle, Xbox Y, Nintendo X.
Game controller SDL back button. Corresponds to the Sony Select, Xbox Back, Nintendo - button.
Game controller SDL guide button. Corresponds to the Sony PS, Xbox Home button.
Game controller SDL start button. Corresponds to the Nintendo + button.
Game controller SDL left stick button. Corresponds to the Sony L3, Xbox L/LS button.
Game controller SDL right stick button. Corresponds to the Sony R3, Xbox R/RS button.
Game controller SDL left shoulder button. Corresponds to the Sony L1, Xbox LB button.
Game controller SDL right shoulder button. Corresponds to the Sony R1, Xbox RB button.
Game controller D-pad up button.
Game controller D-pad down button.
Game controller D-pad left button.
Game controller D-pad right button.
Game controller SDL miscellaneous button. Corresponds to Xbox share button, PS5 microphone button, Nintendo capture button.
Game controller SDL paddle 1 button.
Game controller SDL paddle 2 button.
Game controller SDL paddle 3 button.
Game controller SDL paddle 4 button.
Game controller SDL touchpad button.
The number of SDL game controller buttons.
The maximum number of game controller buttons supported by the engine. The actual limit may be lower on specific platforms:
- Android: Up to 36 buttons.
- Linux: Up to 80 buttons.
- Windows and macOS: Up to 128 buttons.
An invalid game controller axis.
Game controller left joystick x-axis.
Game controller left joystick y-axis.
Game controller right joystick x-axis.
Game controller right joystick y-axis.
Game controller left trigger axis.
Game controller right trigger axis.
The number of SDL game controller axes.
The maximum number of game controller axes: OpenVR supports up to 5 Joysticks making a total of 10 axes.
Enum value which doesn't correspond to any MIDI message. This is used to initialize [enum MIDIMessage] properties with a generic state.
MIDI note OFF message. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs.
MIDI note ON message. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs.
MIDI aftertouch message. This message is most often sent by pressing down on the key after it "bottoms out".
MIDI control change message. This message is sent when a controller value changes. Controllers include devices such as pedals and levers.
MIDI program change message. This message sent when the program patch number changes.
MIDI channel pressure message. This message is most often sent by pressing down on the key after it "bottoms out". This message is different from polyphonic after-touch as it indicates the highest pressure across all keys.
MIDI pitch bend message. This message is sent to indicate a change in the pitch bender (wheel or lever, typically).
MIDI system exclusive message. This has behavior exclusive to the device you're receiving input from. Getting this data is not implemented in Godot.
MIDI quarter frame message. Contains timing information that is used to synchronize MIDI devices. Getting this data is not implemented in Godot.
MIDI song position pointer message. Gives the number of 16th notes since the start of the song. Getting this data is not implemented in Godot.
MIDI song select message. Specifies which sequence or song is to be played. Getting this data is not implemented in Godot.
MIDI tune request message. Upon receiving a tune request, all analog synthesizers should tune their oscillators.
MIDI timing clock message. Sent 24 times per quarter note when synchronization is required.
MIDI start message. Start the current sequence playing. This message will be followed with Timing Clocks.
MIDI continue message. Continue at the point the sequence was stopped.
MIDI stop message. Stop the current sequence.
MIDI active sensing message. This message is intended to be sent repeatedly to tell the receiver that a connection is alive.
MIDI system reset message. Reset all receivers in the system to power-up status. It should not be sent on power-up itself.
Methods that return [enum Error] return [constant OK] when no error occurred. Note that many functions don't return an error code but will print error messages to standard output.
Since [constant OK] has value 0, and all other failure codes are positive integers, it can also be used in boolean checks, e.g.:
[codeblock]
var err = method_that_returns_error()
if err != OK:
print("Failure!")
# Or, equivalent:
if err:
print("Still failing!")
[/codeblock]
Generic error.
Unavailable error.
Unconfigured error.
Unauthorized error.
Parameter range error.
Out of memory (OOM) error.
File: Not found error.
File: Bad drive error.
File: Bad path error.
File: No permission error.
File: Already in use error.
File: Can't open error.
File: Can't write error.
File: Can't read error.
File: Unrecognized error.
File: Corrupt error.
File: Missing dependencies error.
File: End of file (EOF) error.
Can't open error.
Can't create error.
Query failed error.
Already in use error.
Locked error.
Timeout error.
Can't connect error.
Can't resolve error.
Connection error.
Can't acquire resource error.
Can't fork process error.
Invalid data error.
Invalid parameter error.
Already exists error.
Does not exist error.
Database: Read error.
Database: Write error.
Compilation failed error.
Method not found error.
Linking failed error.
Script failed error.
Cycling link (import cycle) error.
Invalid declaration error.
Duplicate symbol error.
Parse error.
Busy error.
Skip error.
Help error.
Bug error.
Printer on fire error. (This is an easter egg, no engine methods return this error code.)
No hint for the edited property.
Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_less"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_less"[/code].
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians"[/code] for editing radian angles in degrees, [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider.
Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string.
The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespaces are [b]not[/b] removed from either end of a name. For integer and float properties, the first name in the list has value 0, the next 1, and so on. Explicit values can also be specified by appending [code]:integer[/code] to the name, e.g. [code]"Zero,One,Three:3,Four,Six:6"[/code].
Hints that a string property can be an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code].
Unlike [constant PROPERTY_HINT_ENUM] a property with this hint still accepts arbitrary values and can be empty. The list of values serves to suggest possible values.
Hints that a float property should be edited via an exponential easing function. The hint string can include [code]"attenuation"[/code] to flip the curve horizontally and/or [code]"positive_only"[/code] to exclude in/out easing and limit values to be greater than or equal to zero.
Hints that a vector property should allow linking values (e.g. to edit both [code]x[/code] and [code]y[/code] together).
Hints that an integer property is a bitmask with named bit flags. For example, to allow toggling bits 0, 1, 2 and 4, the hint could be something like [code]"Bit0,Bit1,Bit2,,Bit4"[/code].
Hints that an integer property is a bitmask using the optionally named 2D render layers.
Hints that an integer property is a bitmask using the optionally named 2D physics layers.
Hints that an integer property is a bitmask using the optionally named 2D navigation layers.
Hints that an integer property is a bitmask using the optionally named 3D render layers.
Hints that an integer property is a bitmask using the optionally named 3D physics layers.
Hints that an integer property is a bitmask using the optionally named 3D navigation layers.
Hints that a string property is a path to a file. Editing it will show a file dialog for picking the path. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code].
Hints that a string property is a path to a directory. Editing it will show a file dialog for picking the path.
Hints that a string property is an absolute path to a file outside the project folder. Editing it will show a file dialog for picking the path. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code].
Hints that a string property is an absolute path to a directory outside the project folder. Editing it will show a file dialog for picking the path.
Hints that a property is an instance of a [Resource]-derived type, optionally specified via the hint string (e.g. [code]"Texture2D"[/code]). Editing it will show a popup menu of valid resource types to instantiate.
Hints that a string property is text with line breaks. Editing it will show a text input field where line breaks can be typed.
Hints that a string property is an [Expression].
Hints that a string property should have a placeholder text visible on its input field, whenever the property is empty. The hint string is the placeholder text to use.
Hints that a color property should be edited without changing its alpha component, i.e. only R, G and B channels are edited.
Hints that an image is compressed using lossy compression.
Hints that an image is compressed using lossless compression.
Hint that a property represents a particular type. If a property is [constant TYPE_STRING], allows to set a type from the create dialog. If you need to create an [Array] to contain elements of a specific type, the [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code] for specifying [Resource] types. For instance:
[codeblock]
hint_string = "%s:" % [TYPE_INT] # Array of inteters.
hint_string = "%s:%s:" % [TYPE_ARRAY, TYPE_REAL] # Two-dimensional array of floats.
hint_string = "%s/%s:Resource" % [TYPE_OBJECT, TYPE_OBJECT] # Array of resources.
hint_string = "%s:%s/%s:Resource" % [TYPE_ARRAY, TYPE_OBJECT, TYPE_OBJECT] # Two-dimensional array of resources.
[/codeblock]
[b]Note:[/b] The final colon is required to specify for properly detecting built-in types.
Hints that a string property is a locale code. Editing it will show a locale dialog for picking language and country.
Hints that a dictionary property is string translation map. Dictionary keys are locale codes and, values are translated strings.
Hints that a quaternion property should disable the temporary euler editor.
Hints that a string property is a password, and every character is replaced with the secret character.
The property is serialized and saved in the scene file (default).
The property is shown in the editor inspector (default).
The property can be checked in the editor inspector.
The property is checked in the editor inspector.
The property is a translatable string.
Used to group properties together in the editor. See [EditorInspector].
Used to categorize properties together in the editor.
Used to group properties together in the editor in a subgroup (under a group). See [EditorInspector].
The property does not save its state in [PackedScene].
Editing the property prompts the user for restarting the editor.
The property is a script variable which should be serialized and saved in the scene file.
The property is read-only in the editor inspector.
Default usage (storage, editor and network).
Default usage for translatable strings (storage, editor, network and internationalized).
Default usage but without showing the property in the editor (storage, network).
Flag for a normal method.
Flag for an editor method.
Flag for a constant method.
Flag for a virtual method.
Used internally. Allows to not dump core virtuals such as [code]_notification[/code] to the JSON API.
Default method flags.
Variable is [code]null[/code].
Variable is of type [bool].
Variable is of type [int].
Variable is of type [float] (real).
Variable is of type [String].
Variable is of type [Vector2].
Variable is of type [Vector2i].
Variable is of type [Rect2].
Variable is of type [Rect2i].
Variable is of type [Vector3].
Variable is of type [Vector3i].
Variable is of type [Transform2D].
Variable is of type [Plane].
Variable is of type [Quaternion].
Variable is of type [AABB].
Variable is of type [Basis].
Variable is of type [Transform3D].
Variable is of type [Color].
Variable is of type [StringName].
Variable is of type [NodePath].
Variable is of type [RID].
Variable is of type [Object].
Variable is of type [Callable].
Variable is of type [Signal].
Variable is of type [Dictionary].
Variable is of type [Array].
Variable is of type [PackedByteArray].
Variable is of type [PackedInt32Array].
Variable is of type [PackedInt64Array].
Variable is of type [PackedFloat32Array].
Variable is of type [PackedFloat64Array].
Variable is of type [PackedStringArray].
Variable is of type [PackedVector2Array].
Variable is of type [PackedVector3Array].
Variable is of type [PackedColorArray].
Represents the size of the [enum Variant.Type] enum.
Equality operator ([code]==[/code]).
Inequality operator ([code]!=[/code]).
Less than operator ([code]<[/code]).
Less than or equal operator ([code]<=[/code]).
Greater than operator ([code]>[/code]).
Greater than or equal operator ([code]>=[/code]).
Addition operator ([code]+[/code]).
Subtraction operator ([code]-[/code]).
Multiplication operator ([code]*[/code]).
Division operator ([code]/[/code]).
Unary negation operator ([code]-[/code]).
Unary plus operator ([code]+[/code]).
Remainder/modulo operator ([code]%[/code]).
Power operator ([code]**[/code]).
Left shift operator ([code]<<[/code]).
Right shift operator ([code]>>[/code]).
Bitwise AND operator ([code]&[/code]).
Bitwise OR operator ([code]|[/code]).
Bitwise XOR operator ([code]^[/code]).
Bitwise NOT operator ([code]~[/code]).
Logical AND operator ([code]and[/code] or [code]&&[/code]).
Logical OR operator ([code]or[/code] or [code]||[/code]).
Logical XOR operator (not implemented in GDScript).
Logical NOT operator ([code]not[/code] or [code]![/code]).
Logical IN operator ([code]in[/code]).
Represents the size of the [enum Variant.Operator] enum.