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). Supported types: [int], [float], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. [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] [b]Note:[/b] For better type safety, use [method absf], [method absi], [method Vector2.abs], [method Vector2i.abs], [method Vector3.abs], [method Vector3i.abs], [method Vector4.abs], or [method Vector4i.abs]. 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] will be clamped between [code]-1.0[/code] and [code]1.0[/code] (inclusive), in order to prevent [method acos] from returning [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 hyperbolic arc (also called inverse) cosine of [param x], returning a value in radians. Use it to get the angle from an angle's cosine in hyperbolic space if [param x] is larger or equal to 1. For values of [param x] lower than 1, it will return 0, in order to prevent [method acosh] from returning [constant @GDScript.NAN]. [codeblock] var a = acosh(2) # Returns 1.31695789692482 cosh(a) # Returns 2 var b = acosh(-1) # Returns 0 [/codeblock] Returns the difference between the two angles, in the range of [code][-PI, +PI][/code]. When [param from] and [param to] are opposite, returns [code]-PI[/code] if [param from] is smaller than [param to], or [code]PI[/code] otherwise. Returns the arc sine of [param x] in radians. Use to get the angle of sine [param x]. [param x] will be clamped between [code]-1.0[/code] and [code]1.0[/code] (inclusive), in order to prevent [method asin] from returning [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 hyperbolic arc (also called inverse) sine of [param x], returning a value in radians. Use it to get the angle from an angle's sine in hyperbolic space. [codeblock] var a = asinh(0.9) # Returns 0.8088669356527824 sinh(a) # Returns 0.9 [/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 skip-lint]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 hyperbolic arc (also called inverse) tangent of [param x], returning a value in radians. Use it to get the angle from an angle's tangent in hyperbolic space if [param x] is between -1 and 1 (non-inclusive). In mathematics, the inverse hyperbolic tangent is only defined for -1 < [param x] < 1 in the real set, so values equal or lower to -1 for [param x] return negative [constant @GDScript.INF] and values equal or higher than 1 return positive [constant @GDScript.INF] in order to prevent [method atanh] from returning [constant @GDScript.NAN]. [codeblock] var a = atanh(0.9) # Returns 1.47221948958322 tanh(a) # Returns 0.9 var b = atanh(-2) # Returns -inf tanh(b) # Returns -1 [/codeblock] Returns the derivative at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points. Returns the point at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier 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], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. [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, use [method ceilf], [method ceili], [method Vector2.ceil], [method Vector3.ceil], or [method Vector4.ceil]. 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], returning a [float]. 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], returning an [int]. Clamps the [param value], returning a [Variant] not less than [param min] and not more than [param max]. Any values that can be compared with the less than and greater than operators will work. [codeblock] var a = clamp(-10, -1, 5) # a is -1 var b = clamp(8.1, 0.9, 5.5) # b is 5.5 [/codeblock] [b]Note:[/b] For better type safety, use [method clampf], [method clampi], [method Vector2.clamp], [method Vector2i.clamp], [method Vector3.clamp], [method Vector3i.clamp], [method Vector4.clamp], [method Vector4i.clamp], or [method Color.clamp] (not currently supported by this method). [b]Note:[/b] When using this on vectors it will [i]not[/i] perform component-wise clamping, and will pick [param min] if [code]value < min[/code] or [param max] if [code]value > max[/code]. To perform component-wise clamping use the methods listed above. Clamps the [param value], returning a [float] not less than [param min] and not more than [param max]. [codeblock] var speed = 42.1 var a = clampf(speed, 1.0, 20.5) # a is 20.5 speed = -10.0 var b = clampf(speed, -1.0, 1.0) # b is -1.0 [/codeblock] Clamps the [param value], returning an [int] not less than [param min] and not more than [param max]. [codeblock] var speed = 42 var a = clampi(speed, 1, 20) # a is 20 speed = -10 var b = clampi(speed, -1, 1) # b is -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] print(cosh(1)) # Prints 1.543081 [/codeblock] Cubic interpolates between two values by the factor defined in [param weight] with [param pre] and [param post] values. Cubic interpolates between two rotation values with shortest path by the factor defined in [param weight] with [param pre] and [param post] values. See also [method lerp_angle]. Cubic interpolates between two rotation values with shortest path by the factor defined in [param weight] with [param pre] and [param post] values. See also [method lerp_angle]. It can perform smoother interpolation than [method cubic_interpolate] by the time values. Cubic interpolates between two values by the factor defined in [param weight] with [param pre] and [param post] values. It can perform smoother interpolation than [method cubic_interpolate] by the time values. Converts from decibels to linear energy (audio). Converts an angle expressed in degrees to radians. [codeblock] var r = deg_to_rad(180) # r is 3.141593 [/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 [enum Error] code. [codeblock] print(OK) # Prints 0 print(error_string(OK)) # Prints OK print(error_string(ERR_BUSY)) # Prints Busy print(error_string(ERR_OUT_OF_MEMORY)) # Prints Out of memory [/codeblock] The natural exponential function. It raises the mathematical constant [i]e[/i] to the power of [param x] and returns it. [i]e[/i] 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], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. [codeblock] var a = floor(2.99) # a is 2.0 a = floor(-2.99) # a is -3.0 [/codeblock] See also [method ceil], [method round], and [method snapped]. [b]Note:[/b] For better type safety, use [method floorf], [method floori], [method Vector2.floor], [method Vector3.floor], or [method Vector4.floor]. 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], returning a [float]. 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], returning an [int]. [b]Note:[/b] This function is [i]not[/i] the same as [code]int(x)[/code], which rounds towards 0. Returns the floating-point remainder of [param x] divided by [param y], keeping the sign of [param x]. [codeblock] var remainder = fmod(7, 5.5) # remainder is 1.5 [/codeblock] For the integer remainder operation, use the [code]%[/code] operator. Returns the floating-point modulus of [param x] divided by [param y], wrapping equally in positive and negative. [codeblock] print(" (x) (fmod(x, 1.5)) (fposmod(x, 1.5))") for i in 7: var x = i * 0.5 - 1.5 print("%4.1f %4.1f | %4.1f" % [x, fmod(x, 1.5), fposmod(x, 1.5)]) [/codeblock] Produces: [codeblock] (x) (fmod(x, 1.5)) (fposmod(x, 1.5)) -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 passed [param variable]. [codeblocks] [gdscript] print(hash("a")) # Prints 177670 [/gdscript] [csharp] GD.Print(GD.Hash("a")); // Prints 177670 [/csharp] [/codeblocks] Returns the [Object] that corresponds to [param instance_id]. All Objects have a unique instance ID. See also [method Object.get_instance_id]. [codeblocks] [gdscript] var foo = "bar" func _ready(): var id = get_instance_id() var inst = instance_from_id(id) print(inst.foo) # Prints bar [/gdscript] [csharp] public partial class MyNode : Node { public string Foo { get; set; } = "bar"; public override void _Ready() { ulong id = GetInstanceId(); var inst = (MyNode)InstanceFromId(Id); GD.Print(inst.Foo); // Prints bar } } [/csharp] [/codeblocks] 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 [param x] is a finite value, i.e. it is not [constant @GDScript.NAN], positive infinity, or negative infinity. Returns [code]true[/code] if [param x] is 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 [code]true[/code] if [param instance] is a valid Object (e.g. has not been deleted from memory). Returns [code]true[/code] if [param x] is a NaN ("Not a Number" or invalid) value. Returns [code]true[/code], for value types, if [param a] and [param b] share the same value. Returns [code]true[/code], for reference types, if the references of [param a] and [param b] are the same. [codeblock] # Vector2 is a value type var vec2_a = Vector2(0, 0) var vec2_b = Vector2(0, 0) var vec2_c = Vector2(1, 1) is_same(vec2_a, vec2_a) # true is_same(vec2_a, vec2_b) # true is_same(vec2_a, vec2_c) # false # Array is a reference type var arr_a = [] var arr_b = [] is_same(arr_a, arr_a) # true is_same(arr_a, arr_b) # false [/codeblock] These are [Variant] value types: [code]null[/code], [bool], [int], [float], [String], [StringName], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i], [Rect2], [Rect2i], [Transform2D], [Transform3D], [Plane], [Quaternion], [AABB], [Basis], [Projection], [Color], [NodePath], [RID], [Callable] and [Signal]. These are [Variant] reference types: [Object], [Dictionary], [Array], [PackedByteArray], [PackedInt32Array], [PackedInt64Array], [PackedFloat32Array], [PackedFloat64Array], [PackedStringArray], [PackedVector2Array], [PackedVector3Array] and [PackedColorArray]. Returns [code]true[/code] if [param x] is zero or almost zero. The comparison is done using a tolerance calculation with a small internal epsilon. This function 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]. If this is not desired, use [method clamp] on the result of this function. Both [param from] and [param to] must be the same type. Supported types: [int], [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, use [method lerpf], [method Vector2.lerp], [method Vector3.lerp], [method Vector4.lerp], [method Color.lerp], [method Quaternion.slerp] or [method Basis.slerp]. Linearly interpolates between two angles (in radians) by a [param weight] value between 0.0 and 1.0. 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 function 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]. If this is not desired, use [method clampf] on the result of this function. [codeblock] lerpf(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). [b]Example:[/b] [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] Returns the [url=https://en.wikipedia.org/wiki/Natural_logarithm]natural logarithm[/url] of [param x] (base [url=https://en.wikipedia.org/wiki/E_(mathematical_constant)][i]e[/i][/url], with [i]e[/i] being approximately 2.71828). This is 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. To use base 10 logarithm, use [code]log(x) / log(10)[/code]. [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 numeric values. This function 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 numeric values. This function 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] amount. Will not go past [param to]. 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(5, 10, 9) # Returns 10 move_toward(10, 5, -1.5) # Returns 11.5 [/codeblock] Returns the smallest integer power of 2 that is greater than or equal to [param value]. [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 expected) nearest_po2(-1) # Returns 0 (this may not be expected) [/codeblock] [b]Warning:[/b] Due to its implementation, this method returns [code]0[/code] rather than [code]1[/code] for values less than or equal to [code]0[/code], with an exception for [param value] being the smallest negative 64-bit integer ([code]-9223372036854775808[/code]) in which case the [param value] is returned unchanged. Wraps [param value] between [code]0[/code] and the [param length]. If the limit is reached, the next value the function returns 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.0 pingpong(-2.0, 3.0) # Returns 2.0 pingpong(-1.0, 3.0) # Returns 1.0 pingpong(0.0, 3.0) # Returns 0.0 pingpong(1.0, 3.0) # Returns 1.0 pingpong(2.0, 3.0) # Returns 2.0 pingpong(3.0, 3.0) # Returns 3.0 pingpong(4.0, 3.0) # Returns 2.0 pingpong(5.0, 3.0) # Returns 1.0 pingpong(6.0, 3.0) # Returns 0.0 [/codeblock] Returns the integer modulus of [param x] divided by [param y] that wraps equally in positive and negative. [codeblock] print("#(i) (i % 3) (posmod(i, 3))") for i in range(-3, 4): print("%2d %2d | %2d" % [i, i % 3, posmod(i, 3)]) [/codeblock] Produces: [codeblock] (i) (i % 3) (posmod(i, 3)) -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]. In GDScript, this is the equivalent of the [code]**[/code] operator. [codeblock] pow(2, 5) # Returns 32.0 pow(4, 1.5) # Returns 8.0 [/codeblock] Converts one or more arguments of any type to string in the best way possible and prints them to the console. [codeblocks] [gdscript] var a = [1, 2, 3] print("a", "b", a) # Prints ab[1, 2, 3] [/gdscript] [csharp] var a = new Godot.Collections.Array { 1, 2, 3 }; GD.Print("a", "b", a); // Prints ab[1, 2, 3] [/csharp] [/codeblocks] [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. 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: [code]b[/code], [code]i[/code], [code]u[/code], [code]s[/code], [code]indent[/code], [code]code[/code], [code]url[/code], [code]center[/code], [code]right[/code], [code]color[/code], [code]bgcolor[/code], [code]fgcolor[/code]. Color tags only support the following named colors: [code]black[/code], [code]red[/code], [code]green[/code], [code]yellow[/code], [code]blue[/code], [code]magenta[/code], [code]pink[/code], [code]purple[/code], [code]cyan[/code], [code]white[/code], [code]orange[/code], [code]gray[/code]. Hexadecimal color codes are not supported. URL tags only support URLs wrapped by a URL tag, not URLs with a different title. When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Support for ANSI escape codes varies across terminal emulators, especially for italic and strikethrough. In standard output, [code]code[/code] is represented with faint text but without any font change. Unsupported tags are left as-is in standard output. [codeblocks] [gdscript skip-lint] print_rich("[color=green][b]Hello world![/b][/color]") # Prints out "Hello world!" in green with a bold font [/gdscript] [csharp skip-lint] GD.PrintRich("[color=green][b]Hello world![/b][/color]"); // Prints out "Hello world!" in green with a bold font [/csharp] [/codeblocks] [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. [b]Note:[/b] On Windows, only Windows 10 and later correctly displays ANSI escape codes in standard output. [b]Note:[/b] Output displayed in the editor supports clickable [code skip-lint][url=address]text[/url][/code] tags. The [code skip-lint][url][/code] tag's [code]address[/code] value is handled by [method OS.shell_open] when clicked. 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. [codeblocks] [gdscript] printerr("prints to stderr") [/gdscript] [csharp] GD.PrintErr("prints to stderr"); [/csharp] [/codeblocks] Prints one or more arguments to strings in the best way possible to the OS terminal. Unlike [method print], no newline is automatically added at the end. [codeblocks] [gdscript] printraw("A") printraw("B") printraw("C") # Prints ABC to terminal [/gdscript] [csharp] GD.PrintRaw("A"); GD.PrintRaw("B"); GD.PrintRaw("C"); // Prints ABC to terminal [/csharp] [/codeblocks] Prints one or more arguments to the console with a space between each argument. [codeblocks] [gdscript] prints("A", "B", "C") # Prints A B C [/gdscript] [csharp] GD.PrintS("A", "B", "C"); // Prints A B C [/csharp] [/codeblocks] Prints one or more arguments to the console with a tab between each argument. [codeblocks] [gdscript] printt("A", "B", "C") # Prints A B C [/gdscript] [csharp] GD.PrintT("A", "B", "C"); // Prints A B C [/csharp] [/codeblocks] Pushes an error message to Godot's built-in debugger and to the OS terminal. [codeblocks] [gdscript] push_error("test error") # Prints "test error" to debugger and terminal as error call [/gdscript] [csharp] GD.PushError("test error"); // Prints "test error" to debugger and terminal as error call [/csharp] [/codeblocks] [b]Note:[/b] This function does 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. [codeblocks] [gdscript] push_warning("test warning") # Prints "test warning" to debugger and terminal as warning call [/gdscript] [csharp] GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as warning call [/csharp] [/codeblocks] Converts an angle expressed in radians to degrees. [codeblock] rad_to_deg(0.523599) # Returns 30 rad_to_deg(PI) # Returns 180 rad_to_deg(PI * 2) # Returns 360 [/codeblock] Given a [param seed], returns a [PackedInt64Array] of size [code]2[/code], where its first element is the randomized [int] value, and the second element is the same as [param seed]. Passing the same [param seed] consistently returns the same array. [b]Note:[/b] "Seed" here refers to the internal state of the pseudo random number generator, currently implemented as a 64 bit integer. [codeblock] var a = rand_from_seed(4) print(a[0]) # Prints 2879024997 print(a[1]) # Prints 4 [/codeblock] Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive). [codeblocks] [gdscript] randf() # Returns e.g. 0.375671 [/gdscript] [csharp] GD.Randf(); // Returns e.g. 0.375671 [/csharp] [/codeblocks] Returns a random floating point value between [param from] and [param to] (inclusive). [codeblocks] [gdscript] randf_range(0, 20.5) # Returns e.g. 7.45315 randf_range(-10, 10) # Returns e.g. -3.844535 [/gdscript] [csharp] GD.RandRange(0.0, 20.5); // Returns e.g. 7.45315 GD.RandRange(-10.0, 10.0); // Returns e.g. -3.844535 [/csharp] [/codeblocks] 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). [codeblocks] [gdscript] 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 [/gdscript] [csharp] GD.Randi(); // Returns random integer between 0 and 2^32 - 1 GD.Randi() % 20; // Returns random integer between 0 and 19 GD.Randi() % 100; // Returns random integer between 0 and 99 GD.Randi() % 100 + 1; // Returns random integer between 1 and 100 [/csharp] [/codeblocks] 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. [codeblocks] [gdscript] randi_range(0, 1) # Returns either 0 or 1 randi_range(-10, 1000) # Returns random integer between -10 and 1000 [/gdscript] [csharp] GD.RandRange(0, 1); // Returns either 0 or 1 GD.RandRange(-10, 1000); // Returns random integer between -10 and 1000 [/csharp] [/codeblocks] Randomizes the seed (or the internal state) of the random number generator. The current implementation uses a number based on the device's time. [b]Note:[/b] This function is called automatically when the project is run. If you need to fix the seed to have consistent, 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]. If this is not desired, use [method clamp] on the result of this function. [codeblock] remap(75, 0, 100, -1, 1) # Returns 0.5 [/codeblock] For complex use cases where multiple ranges are needed, consider using [Curve] or [Gradient] instead. Allocates a unique ID which can be used by the implementation to construct a RID. This is used mainly from native extensions to implement servers. Creates a RID from a [param base]. This is used mainly from native extensions to build servers. Rotates [param from] toward [param to] by the [param delta] amount. Will not go past [param to]. Similar to [method move_toward], but interpolates correctly when the angles wrap around [constant @GDScript.TAU]. If [param delta] is negative, this function will rotate away from [param to], toward the opposite angle, and will not go past the opposite angle. Rounds [param x] to the nearest whole number, with halfway cases rounded away from 0. Supported types: [int], [float], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. [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, use [method roundf], [method roundi], [method Vector2.round], [method Vector3.round], or [method Vector4.round]. Rounds [param x] to the nearest whole number, with halfway cases rounded away from 0. A type-safe version of [method round], returning a [float]. Rounds [param x] to the nearest whole number, with halfway cases rounded away from 0. A type-safe version of [method round], returning an [int]. Sets the seed for the random number generator to [param base]. Setting the seed manually can ensure consistent, repeatable results for most random functions. [codeblocks] [gdscript] var my_seed = "Godot Rocks".hash() seed(my_seed) var a = randf() + randi() seed(my_seed) var b = randf() + randi() # a and b are now identical [/gdscript] [csharp] ulong mySeed = (ulong)GD.Hash("Godot Rocks"); GD.Seed(mySeed); var a = GD.Randf() + GD.Randi(); GD.Seed(mySeed); var b = GD.Randf() + GD.Randi(); // a and b are now identical [/csharp] [/codeblocks] Returns the same type of [Variant] as [param x], with [code]-1[/code] for negative values, [code]1[/code] for positive values, and [code]0[/code] for zeros. For [code]nan[/code] values it returns 0. Supported types: [int], [float], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. [codeblock] sign(-6.0) # Returns -1 sign(0.0) # Returns 0 sign(6.0) # Returns 1 sign(NAN) # Returns 0 sign(Vector3(-6.0, 0.0, 6.0)) # Returns (-1, 0, 1) [/codeblock] [b]Note:[/b] For better type safety, use [method signf], [method signi], [method Vector2.sign], [method Vector2i.sign], [method Vector3.sign], [method Vector3i.sign], [method Vector4.sign], or [method Vector4i.sign]. Returns [code]-1.0[/code] if [param x] is negative, [code]1.0[/code] if [param x] is positive, and [code]0.0[/code] if [param x] is zero. For [code]nan[/code] values of [param x] it returns 0.0. [codeblock] signf(-6.5) # Returns -1.0 signf(0.0) # Returns 0.0 signf(6.5) # Returns 1.0 signf(NAN) # Returns 0.0 [/codeblock] Returns [code]-1[/code] if [param x] is negative, [code]1[/code] if [param x] is positive, and [code]0[/code] if if [param x] is zero. [codeblock] signi(-6) # Returns -1 signi(0) # Returns 0 signi(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] Returns the multiple of [param step] that is the closest to [param x]. This can also be used to round a floating point number to an arbitrary number of decimals. The returned value is the same type of [Variant] as [param step]. Supported types: [int], [float], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. [codeblock] snapped(100, 32) # Returns 96 snapped(3.14159, 0.01) # Returns 3.14 snapped(Vector2(34, 70), Vector2(8, 8)) # Returns (32, 72) [/codeblock] See also [method ceil], [method floor], and [method round]. [b]Note:[/b] For better type safety, use [method snappedf], [method snappedi], [method Vector2.snapped], [method Vector2i.snapped], [method Vector3.snapped], [method Vector3i.snapped], [method Vector4.snapped], or [method Vector4i.snapped]. Returns the multiple of [param step] that is the closest to [param x]. This can also be used to round a floating point number to an arbitrary number of decimals. A type-safe version of [method snapped], returning a [float]. [codeblock] snappedf(32.0, 2.5) # Returns 32.5 snappedf(3.14159, 0.01) # Returns 3.14 [/codeblock] Returns the multiple of [param step] that is the closest to [param x]. A type-safe version of [method snapped], returning an [int]. [codeblock] snappedi(53, 16) # Returns 48 snappedi(4096, 100) # Returns 4100 [/codeblock] Returns the square root of [param x], where [param x] is a non-negative number. [codeblock] sqrt(9) # Returns 3 sqrt(10.24) # Returns 3.2 sqrt(-1) # Returns NaN [/codeblock] [b]Note:[/b] Negative values of [param x] return NaN ("Not a Number"). in C#, if you need negative inputs, use [code]System.Numerics.Complex[/code]. 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] var n = step_decimals(5) # n is 0 n = step_decimals(1.0005) # n is 4 n = step_decimals(0.000000005) # n is 9 [/codeblock] Converts one or more arguments of any [Variant] type to a [String] in the best way possible. [codeblock] var a = [10, 20, 30] var b = str(a) print(len(a)) # Prints 3 (the number of elements in the array). print(len(b)) # Prints 12 (the length of the string "[10, 20, 30]"). [/codeblock] Converts a formatted [param string] that was returned by [method var_to_str] to the original [Variant]. [codeblocks] [gdscript] var data = '{ "a": 1, "b": 2 }' # data is a String var dict = str_to_var(data) # dict is a Dictionary print(dict["a"]) # Prints 1 [/gdscript] [csharp] string data = "{ \"a\": 1, \"b\": 2 }"; // data is a string var dict = GD.StrToVar(data).AsGodotDictionary(); // dict is a Dictionary GD.Print(dict["a"]); // Prints 1 [/csharp] [/codeblocks] 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] Converts the given [param variant] to the given [param type], using the [enum Variant.Type] values. This method is generous with how it handles types, it can automatically convert between array types, convert numeric [String]s to [int], and converting most things to [String]. If the type conversion cannot be done, this method will return the default value for that type, for example converting [Rect2] to [Vector2] will always return [constant Vector2.ZERO]. This method will never show error messages as long as [param type] is a valid Variant type. The returned value is a [Variant], but the data inside and its type will be the same as the requested type. [codeblock] type_convert("Hi!", TYPE_INT) # Returns 0 type_convert("123", TYPE_INT) # Returns 123 type_convert(123.4, TYPE_INT) # Returns 123 type_convert(5, TYPE_VECTOR2) # Returns (0, 0) type_convert("Hi!", TYPE_NIL) # Returns null [/codeblock] Returns a human-readable name of the given [param type], using the [enum Variant.Type] values. [codeblock] print(TYPE_INT) # Prints 2. print(type_string(TYPE_INT)) # Prints "int". print(type_string(TYPE_STRING)) # Prints "String". [/codeblock] See also [method typeof]. Returns the internal type of the given [param variable], 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] See also [method type_string]. 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]. [b]Note:[/b] Encoding [Callable] is not supported and will result in an empty value, regardless of the data. Encodes a [Variant] value to a byte array. Encoding objects is allowed (and can potentially include executable code). Deserialization can be done with [method bytes_to_var_with_objects]. [b]Note:[/b] Encoding [Callable] is not supported and will result in an empty value, regardless of the data. Converts a [Variant] [param variable] to a formatted [String] that can then be parsed using [method str_to_var]. [codeblocks] [gdscript] var a = { "a": 1, "b": 2 } print(var_to_str(a)) [/gdscript] [csharp] var a = new Godot.Collections.Dictionary { ["a"] = 1, ["b"] = 2 }; GD.Print(GD.VarToStr(a)); [/csharp] [/codeblocks] Prints: [codeblock] { "a": 1, "b": 2 } [/codeblock] [b]Note:[/b] Converting [Signal] or [Callable] is not supported and will result in an empty value for these types, regardless of their data. Returns a [WeakRef] instance holding a weak reference to [param obj]. Returns an empty [WeakRef] instance if [param obj] is [code]null[/code]. Prints an error and returns [code]null[/code] if [param obj] is neither [Object]-derived nor [code]null[/code]. 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]. Can be used for creating loop-alike behavior or infinite surfaces. Variant types [int] and [float] are supported. If any of the arguments is [float] this function returns a [float], otherwise it returns an [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 the float [param value] between [param min] and [param max]. Can be used 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. [method wrapf] is more flexible than using the [method fposmod] approach by giving the user control over the minimum value. Wraps the integer [param value] between [param min] and [param max]. Can be used 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 [EditorInterface] singleton. [b]Note:[/b] Only available in editor builds. The [Engine] singleton. The [EngineDebugger] singleton. The [GDExtensionManager] 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 [NavigationServer3D] 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. Clockwise rotation. Used by some methods (e.g. [method Image.rotate_90]). Counter-clockwise rotation. Used by some methods (e.g. [method Image.rotate_90]). 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 baseline (user defined) 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. 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. 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. 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. 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. 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. 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 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. Context menu key. Hyper key. (On Linux/X11 only). Help 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. 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. "Globe" key on Mac / iPad keyboard. "On-screen keyboard" key on iPad keyboard. 英数 key on Mac keyboard. かな key on Mac keyboard. Unknown key. Space key. ! key. " key. # key. $ key. % key. & key. ' key. ( key. ) key. * key. + key. , key. - key. . key. / key. Number 0 key. Number 1 key. Number 2 key. Number 3 key. Number 4 key. Number 5 key. Number 6 key. Number 7 key. Number 8 key. Number 9 key. : 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. ¥ 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. Control key mask. Keypad key mask. Group Switch key mask. Used for keys which only appear once, or when a comparison doesn't need to differentiate the [code]LEFT[/code] and [code]RIGHT[/code] versions. For example, when using [method InputEvent.is_match], an event which has [constant KEY_LOCATION_UNSPECIFIED] will match any [enum KeyLocation] on the passed event. A key which is to the left of its twin. A key which is to the right of its twin. 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 assigned to the left button. Secondary mouse button, usually assigned to the right button. Middle mouse button. Mouse wheel scrolling up. Mouse wheel scrolling down. Mouse wheel left button (only present on some mice). Mouse wheel right button (only present on some mice). Extra mouse button 1. This is sometimes present, usually to the sides of the mouse. Extra mouse button 2. This is sometimes present, usually to the sides of the mouse. 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 Sony Options, Xbox Menu, 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 Switch 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: - [b]Android:[/b] Up to 36 buttons. - [b]Linux:[/b] Up to 80 buttons. - [b]Windows[/b] and [b]macOS:[/b] 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. Does not correspond to any MIDI message. This is the default value of [member InputEventMIDI.message]. MIDI message sent when a note is released. [b]Note:[/b] Not all MIDI devices send this message; some may send [constant MIDI_MESSAGE_NOTE_ON] with [member InputEventMIDI.velocity] set to [code]0[/code]. MIDI message sent when a note is pressed. MIDI message sent to indicate a change in pressure while a note is being pressed down, also called aftertouch. MIDI message sent when a controller value changes. In a MIDI device, a controller is any input that doesn't play notes. These may include sliders for volume, balance, and panning, as well as switches and pedals. See the [url=https://en.wikipedia.org/wiki/General_MIDI#Controller_events]General MIDI specification[/url] for a small list. MIDI message sent when the MIDI device changes its current instrument (also called [i]program[/i] or [i]preset[/i]). MIDI message sent to indicate a change in pressure for the whole channel. Some MIDI devices may send this instead of [constant MIDI_MESSAGE_AFTERTOUCH]. MIDI message sent when the value of the pitch bender changes, usually a wheel on the MIDI device. MIDI system exclusive (SysEx) message. This type of message is not standardized and it's highly dependent on the MIDI device sending it. [b]Note:[/b] Getting this message's data from [InputEventMIDI] is not implemented. MIDI message sent every quarter frame to keep connected MIDI devices synchronized. Related to [constant MIDI_MESSAGE_TIMING_CLOCK]. [b]Note:[/b] Getting this message's data from [InputEventMIDI] is not implemented. MIDI message sent to jump onto a new position in the current sequence or song. [b]Note:[/b] Getting this message's data from [InputEventMIDI] is not implemented. MIDI message sent to select a sequence or song to play. [b]Note:[/b] Getting this message's data from [InputEventMIDI] is not implemented. MIDI message sent to request a tuning calibration. Used on analog synthesizers. Most modern MIDI devices do not need this message. MIDI message sent 24 times after [constant MIDI_MESSAGE_QUARTER_FRAME], to keep connected MIDI devices synchronized. MIDI message sent to start the current sequence or song from the beginning. MIDI message sent to resume from the point the current sequence or song was paused. MIDI message sent to pause the current sequence or song. MIDI message sent repeatedly while the MIDI device is idle, to tell the receiver that the connection is alive. Most MIDI devices do not send this message. MIDI message sent to reset a MIDI device to its default state, as if it was just turned on. It should not be sent when the MIDI device is being turned on. Methods that return [enum Error] return [constant OK] when no error occurred. Since [constant OK] has value 0, and all other error constants are positive integers, it can also be used in boolean checks. [b]Example:[/b] [codeblock] var error = method_that_returns_error() if error != OK: printerr("Failure!") # Or, alternatively: if error: printerr("Still failing!") [/codeblock] [b]Note:[/b] Many functions do not return an error code, but will print error messages to standard output. 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. Used internally when passing [code]--version[/code] or [code]--help[/code] as executable options. Bug error, caused by an implementation issue in the method. [b]Note:[/b] If a built-in method returns this code, please open an issue on [url=https://github.com/godotengine/godot/issues]the GitHub Issue Tracker[/url]. Printer on fire error (This is an easter egg, no built-in methods return this error code). The property has no hint for the editor. Hints that an [int] 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. [b]Example:[/b] [code]"-360,360,1,or_greater,or_less"[/code]. Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians_as_degrees"[/code] for editing radian angles in degrees (the range values are also in degrees), [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider. Hints that an [int] 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 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 its components to be linked. For example, this allows [member Vector2.x] and [member Vector2.y] to be edited together. Hints that an [int] property is a bitmask with named bit flags. The hint string is a comma separated list of names such as [code]"Bit0,Bit1,Bit2,Bit3"[/code]. Whitespaces are [b]not[/b] removed from either end of a name. The first name in the list has value 1, the next 2, then 4, 8, 16 and so on. Explicit values can also be specified by appending [code]:integer[/code] to the name, e.g. [code]"A:4,B:8,C:16"[/code]. You can also combine several flags ([code]"A:4,B:8,AB:12,C:16"[/code]). [b]Note:[/b] A flag value must be at least [code]1[/code] and at most [code]2 ** 32 - 1[/code]. [b]Note:[/b] Unlike [constant PROPERTY_HINT_ENUM], the previous explicit value is not taken into account. For the hint [code]"A:16,B,C"[/code], A is 16, B is 2, C is 4. Hints that an [int] property is a bitmask using the optionally named 2D render layers. Hints that an [int] property is a bitmask using the optionally named 2D physics layers. Hints that an [int] property is a bitmask using the optionally named 2D navigation layers. Hints that an [int] property is a bitmask using the optionally named 3D render layers. Hints that an [int] property is a bitmask using the optionally named 3D physics layers. Hints that an [int] property is a bitmask using the optionally named 3D navigation layers. Hints that an integer property is a bitmask using the optionally named avoidance 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 show a placeholder text on its input field, if empty. The hint string is the placeholder text to use. Hints that a [Color] property should be edited without affecting its transparency ([member Color.a] is not editable). Hints that the property's value is an object encoded as object ID, with its type specified in the hint string. Used by the debugger. If a property is [String], hints that the property represents a particular type (class). This allows to select a type from the create dialog. The property will store the selected type as a string. If a property is [Array], hints the editor how to show elements. The [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code]. [codeblocks] [gdscript] # Array of elem_type. hint_string = "%d:" % [elem_type] hint_string = "%d/%d:%s" % [elem_type, elem_hint, elem_hint_string] # Two-dimensional array of elem_type (array of arrays of elem_type). hint_string = "%d:%d:" % [TYPE_ARRAY, elem_type] hint_string = "%d:%d/%d:%s" % [TYPE_ARRAY, elem_type, elem_hint, elem_hint_string] # Three-dimensional array of elem_type (array of arrays of arrays of elem_type). hint_string = "%d:%d:%d:" % [TYPE_ARRAY, TYPE_ARRAY, elem_type] hint_string = "%d:%d:%d/%d:%s" % [TYPE_ARRAY, TYPE_ARRAY, elem_type, elem_hint, elem_hint_string] [/gdscript] [csharp] // Array of elemType. hintString = $"{elemType:D}:"; hintString = $"{elemType:}/{elemHint:D}:{elemHintString}"; // Two-dimensional array of elemType (array of arrays of elemType). hintString = $"{Variant.Type.Array:D}:{elemType:D}:"; hintString = $"{Variant.Type.Array:D}:{elemType:D}/{elemHint:D}:{elemHintString}"; // Three-dimensional array of elemType (array of arrays of arrays of elemType). hintString = $"{Variant.Type.Array:D}:{Variant.Type.Array:D}:{elemType:D}:"; hintString = $"{Variant.Type.Array:D}:{Variant.Type.Array:D}:{elemType:D}/{elemHint:D}:{elemHintString}"; [/csharp] [/codeblocks] Examples: [codeblocks] [gdscript] hint_string = "%d:" % [TYPE_INT] # Array of integers. hint_string = "%d/%d:1,10,1" % [TYPE_INT, PROPERTY_HINT_RANGE] # Array of integers (in range from 1 to 10). hint_string = "%d/%d:Zero,One,Two" % [TYPE_INT, PROPERTY_HINT_ENUM] # Array of integers (an enum). hint_string = "%d/%d:Zero,One,Three:3,Six:6" % [TYPE_INT, PROPERTY_HINT_ENUM] # Array of integers (an enum). hint_string = "%d/%d:*.png" % [TYPE_STRING, PROPERTY_HINT_FILE] # Array of strings (file paths). hint_string = "%d/%d:Texture2D" % [TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # Array of textures. hint_string = "%d:%d:" % [TYPE_ARRAY, TYPE_FLOAT] # Two-dimensional array of floats. hint_string = "%d:%d/%d:" % [TYPE_ARRAY, TYPE_STRING, PROPERTY_HINT_MULTILINE_TEXT] # Two-dimensional array of multiline strings. hint_string = "%d:%d/%d:-1,1,0.1" % [TYPE_ARRAY, TYPE_FLOAT, PROPERTY_HINT_RANGE] # Two-dimensional array of floats (in range from -1 to 1). hint_string = "%d:%d/%d:Texture2D" % [TYPE_ARRAY, TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # Two-dimensional array of textures. [/gdscript] [csharp] hintString = $"{Variant.Type.Int:D}/{PropertyHint.Range:D}:1,10,1"; // Array of integers (in range from 1 to 10). hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Two"; // Array of integers (an enum). hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Three:3,Six:6"; // Array of integers (an enum). hintString = $"{Variant.Type.String:D}/{PropertyHint.File:D}:*.png"; // Array of strings (file paths). hintString = $"{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // Array of textures. hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}:"; // Two-dimensional array of floats. hintString = $"{Variant.Type.Array:D}:{Variant.Type.String:D}/{PropertyHint.MultilineText:D}:"; // Two-dimensional array of multiline strings. hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}/{PropertyHint.Range:D}:-1,1,0.1"; // Two-dimensional array of floats (in range from -1 to 1). hintString = $"{Variant.Type.Array:D}:{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // Two-dimensional array of textures. [/csharp] [/codeblocks] [b]Note:[/b] The trailing colon is required for properly detecting built-in types. Hints that an object is too big to be sent via the debugger. Hints that the hint string specifies valid node types for property of type [NodePath]. Hints that a [String] property is a path to a file. Editing it will show a file dialog for picking the path for the file to be saved at. The dialog has access to the project's directory. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code]. See also [member FileDialog.filters]. Hints that a [String] property is a path to a file. Editing it will show a file dialog for picking the path for the file to be saved at. The dialog has access to the entire filesystem. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code]. See also [member FileDialog.filters]. Hints that an [int] property is a pointer. Used by GDExtension. Hints that a property is an [Array] with the stored type specified in the hint string. 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 property is an instance of a [Node]-derived type, optionally specified via the hint string (e.g. [code]"Node2D"[/code]). Editing it will show a dialog for picking a node from the scene. 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. Represents the size of the [enum PropertyHint] enum. The property is not stored, and does not display in the editor. This is the default for non-exported properties. The property is serialized and saved in the scene file (default). The property is shown in the [EditorInspector] (default). The property is excluded from the class reference. The property can be checked in the [EditorInspector]. The property is checked in the [EditorInspector]. 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 is a bitfield, i.e. it contains multiple flags represented as bits. 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 value of type [Object] will be stored even if its value is [code]null[/code]. If this property is modified, all inspector fields will be refreshed. The property is an enum, i.e. it only takes named integer constants from its associated enumeration. If property has [code]nil[/code] as default value, its type will be [Variant]. The property is an array. When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should always be duplicated, regardless of the [code]subresources[/code] bool parameter. When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should never be duplicated, regardless of the [code]subresources[/code] bool parameter. The property is only shown in the editor if modern renderers are supported (the Compatibility rendering method is excluded). The [NodePath] property will always be relative to the scene's root. Mostly useful for local resources. Use when a resource is created on the fly, i.e. the getter will always return a different instance. [ResourceSaver] needs this information to properly save such resources. Inserting an animation key frame of this property will automatically increment the value, allowing to easily keyframe multiple values in a row. When this property is a [Resource] and base object is a [Node], a resource instance will be automatically created whenever the node is created in the editor. The property is considered a basic setting and will appear even when advanced mode is disabled. Used for project settings. The property is read-only in the [EditorInspector]. An export preset property with this flag contains confidential information and is stored separately from the rest of the export preset configuration. Default usage (storage and editor). Default usage but without showing the property in the editor (storage). Flag for a normal method. Flag for an editor method. Flag for a constant method. Flag for a virtual method. Flag for a method with a variable number of arguments. Flag for a static method. Used internally. Allows to not dump core virtual methods (such as [method Object._notification]) to the JSON API. Default method flags (normal). Variable is [code]null[/code]. Variable is of type [bool]. Variable is of type [int]. Variable is of type [float]. 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 [Vector4]. Variable is of type [Vector4i]. 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 [Projection]. 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.