Skip to main content

SignalsOfInput

Struct SignalsOfInput 

pub struct SignalsOfInput<'c, C>
where C: WithSignals,
{ /* private fields */ }
Expand description

A collection of signals for the Input class.

Implementations§

§

impl<'c, C> SignalsOfInput<'c, C>
where C: WithSignals,

pub fn joy_connection_changed(&mut self) -> SigJoyConnectionChanged<'c, C>

Signature: (device: i64, connected: bool)

Methods from Deref<Target = <<Input as GodotClass>::Base as WithSignals>::SignalCollection<'c, C>>§

pub fn is_anything_pressed(&self) -> bool

Returns true if any action, key, joypad button, or mouse button is being pressed. This will also return true if any action is simulated via code by calling action_press.

pub fn is_key_pressed(&self, keycode: Key) -> bool

Returns true if you are pressing the Latin key in the current keyboard layout. You can pass a [enum Key] constant.

is_key_pressed is only recommended over is_physical_key_pressed in non-game applications. This ensures that shortcut keys behave as expected depending on the user’s keyboard layout, as keyboard shortcuts are generally dependent on the keyboard layout in non-game applications. If in doubt, use is_physical_key_pressed.

Note: Due to keyboard ghosting, is_key_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

pub fn is_physical_key_pressed(&self, keycode: Key) -> bool

Returns true if you are pressing the key in the physical location on the 101/102-key US QWERTY keyboard. You can pass a [enum Key] constant.

is_physical_key_pressed is recommended over is_key_pressed for in-game actions, as it will make W/A/S/D layouts work regardless of the user’s keyboard layout. is_physical_key_pressed will also ensure that the top row number keys work on any keyboard layout. If in doubt, use is_physical_key_pressed.

Note: Due to keyboard ghosting, is_physical_key_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

pub fn is_key_label_pressed(&self, keycode: Key) -> bool

Returns true if you are pressing the key with the keycode printed on it. You can pass a [enum Key] constant or any Unicode character code.

pub fn is_mouse_button_pressed(&self, button: MouseButton) -> bool

Returns true if you are pressing the mouse button specified with [enum MouseButton].

pub fn is_joy_button_pressed(&self, device: i32, button: JoyButton) -> bool

Returns true if you are pressing the joypad button at index button.

pub fn is_action_pressed(&self, action: impl AsArg<StringName>) -> bool

To set the default parameters, use is_action_pressed_ex and its builder methods. See the book for detailed usage instructions. Returns true if you are pressing the action event.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: Due to keyboard ghosting, is_action_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

pub fn is_action_pressed_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, ) -> ExIsActionPressed<'ex>

Returns true if you are pressing the action event.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: Due to keyboard ghosting, is_action_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

pub fn is_action_just_pressed(&self, action: impl AsArg<StringName>) -> bool

To set the default parameters, use is_action_just_pressed_ex and its builder methods. See the book for detailed usage instructions. Returns true when the user has started pressing the action event in the current frame or physics tick. It will only return true on the frame or tick that the user pressed down the button.

This is useful for code that needs to run only once when an action is pressed, instead of every frame while it’s pressed.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: Returning true does not imply that the action is still pressed. An action can be pressed and released again rapidly, and true will still be returned so as not to miss input.

Note: Due to keyboard ghosting, is_action_just_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

Note: During input handling (e.g. input), use is_action_pressed instead to query the action state of the current event. See also is_action_just_pressed_by_event.

pub fn is_action_just_pressed_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, ) -> ExIsActionJustPressed<'ex>

Returns true when the user has started pressing the action event in the current frame or physics tick. It will only return true on the frame or tick that the user pressed down the button.

This is useful for code that needs to run only once when an action is pressed, instead of every frame while it’s pressed.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: Returning true does not imply that the action is still pressed. An action can be pressed and released again rapidly, and true will still be returned so as not to miss input.

Note: Due to keyboard ghosting, is_action_just_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

Note: During input handling (e.g. input), use is_action_pressed instead to query the action state of the current event. See also is_action_just_pressed_by_event.

pub fn is_action_just_released(&self, action: impl AsArg<StringName>) -> bool

To set the default parameters, use is_action_just_released_ex and its builder methods. See the book for detailed usage instructions. Returns true when the user stops pressing the action event in the current frame or physics tick. It will only return true on the frame or tick that the user releases the button.

Note: Returning true does not imply that the action is still not pressed. An action can be released and pressed again rapidly, and true will still be returned so as not to miss input.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: During input handling (e.g. input), use is_action_released instead to query the action state of the current event. See also is_action_just_released_by_event.

pub fn is_action_just_released_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, ) -> ExIsActionJustReleased<'ex>

Returns true when the user stops pressing the action event in the current frame or physics tick. It will only return true on the frame or tick that the user releases the button.

Note: Returning true does not imply that the action is still not pressed. An action can be released and pressed again rapidly, and true will still be returned so as not to miss input.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: During input handling (e.g. input), use is_action_released instead to query the action state of the current event. See also is_action_just_released_by_event.

pub fn is_action_just_pressed_by_event( &self, action: impl AsArg<StringName>, event: impl AsArg<Gd<InputEvent>>, ) -> bool

To set the default parameters, use is_action_just_pressed_by_event_ex and its builder methods. See the book for detailed usage instructions. Returns true when the user has started pressing the action event in the current frame or physics tick, and the first event that triggered action press in the current frame/physics tick was event. It will only return true on the frame or tick that the user pressed down the button.

This is useful for code that needs to run only once when an action is pressed, and the action is processed during input handling (e.g. input).

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: Returning true does not imply that the action is still pressed. An action can be pressed and released again rapidly, and true will still be returned so as not to miss input.

Note: Due to keyboard ghosting, is_action_just_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

pub fn is_action_just_pressed_by_event_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, event: impl AsArg<Gd<InputEvent>> + 'ex, ) -> ExIsActionJustPressedByEvent<'ex>

Returns true when the user has started pressing the action event in the current frame or physics tick, and the first event that triggered action press in the current frame/physics tick was event. It will only return true on the frame or tick that the user pressed down the button.

This is useful for code that needs to run only once when an action is pressed, and the action is processed during input handling (e.g. input).

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

Note: Returning true does not imply that the action is still pressed. An action can be pressed and released again rapidly, and true will still be returned so as not to miss input.

Note: Due to keyboard ghosting, is_action_just_pressed may return false even if one of the action’s keys is pressed. See Input examples in the documentation for more information.

pub fn is_action_just_released_by_event( &self, action: impl AsArg<StringName>, event: impl AsArg<Gd<InputEvent>>, ) -> bool

To set the default parameters, use is_action_just_released_by_event_ex and its builder methods. See the book for detailed usage instructions. Returns true when the user stops pressing the action event in the current frame or physics tick, and the first event that triggered action release in the current frame/physics tick was event. It will only return true on the frame or tick that the user releases the button.

This is useful when an action is processed during input handling (e.g. input).

Note: Returning true does not imply that the action is still not pressed. An action can be released and pressed again rapidly, and true will still be returned so as not to miss input.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

pub fn is_action_just_released_by_event_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, event: impl AsArg<Gd<InputEvent>> + 'ex, ) -> ExIsActionJustReleasedByEvent<'ex>

Returns true when the user stops pressing the action event in the current frame or physics tick, and the first event that triggered action release in the current frame/physics tick was event. It will only return true on the frame or tick that the user releases the button.

This is useful when an action is processed during input handling (e.g. input).

Note: Returning true does not imply that the action is still not pressed. An action can be released and pressed again rapidly, and true will still be returned so as not to miss input.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

pub fn get_action_strength(&self, action: impl AsArg<StringName>) -> f32

To set the default parameters, use get_action_strength_ex and its builder methods. See the book for detailed usage instructions. Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis such as the keyboard, the value returned will be 0 or 1.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

pub fn get_action_strength_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, ) -> ExGetActionStrength<'ex>

Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis such as the keyboard, the value returned will be 0 or 1.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

pub fn get_action_raw_strength(&self, action: impl AsArg<StringName>) -> f32

To set the default parameters, use get_action_raw_strength_ex and its builder methods. See the book for detailed usage instructions. Returns a value between 0 and 1 representing the raw intensity of the given action, ignoring the action’s deadzone. In most cases, you should use get_action_strength instead.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

pub fn get_action_raw_strength_ex<'ex>( &'ex self, action: impl AsArg<StringName> + 'ex, ) -> ExGetActionRawStrength<'ex>

Returns a value between 0 and 1 representing the raw intensity of the given action, ignoring the action’s deadzone. In most cases, you should use get_action_strength instead.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

pub fn get_axis( &self, negative_action: impl AsArg<StringName>, positive_action: impl AsArg<StringName>, ) -> f32

Get axis input by specifying two actions, one negative and one positive.

This is a shorthand for writing Input.get_action_strength("positive_action") - Input.get_action_strength("negative_action").

pub fn get_vector( &self, negative_x: impl AsArg<StringName>, positive_x: impl AsArg<StringName>, negative_y: impl AsArg<StringName>, positive_y: impl AsArg<StringName>, ) -> Vector2

To set the default parameters, use get_vector_ex and its builder methods. See the book for detailed usage instructions. Gets an input vector by specifying four actions for the positive and negative X and Y axes.

This method is useful when getting vector input, such as from a joystick, directional pad, arrows, or WASD. The vector has its length limited to 1 and has a circular deadzone, which is useful for using vector input as movement.

By default, the deadzone is automatically calculated from the average of the action deadzones. However, you can override the deadzone to be whatever you want (on the range of 0 to 1).

pub fn get_vector_ex<'ex>( &'ex self, negative_x: impl AsArg<StringName> + 'ex, positive_x: impl AsArg<StringName> + 'ex, negative_y: impl AsArg<StringName> + 'ex, positive_y: impl AsArg<StringName> + 'ex, ) -> ExGetVector<'ex>

Gets an input vector by specifying four actions for the positive and negative X and Y axes.

This method is useful when getting vector input, such as from a joystick, directional pad, arrows, or WASD. The vector has its length limited to 1 and has a circular deadzone, which is useful for using vector input as movement.

By default, the deadzone is automatically calculated from the average of the action deadzones. However, you can override the deadzone to be whatever you want (on the range of 0 to 1).

pub fn add_joy_mapping(&mut self, mapping: impl AsArg<GString>)

To set the default parameters, use add_joy_mapping_ex and its builder methods. See the book for detailed usage instructions. Adds a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices.

pub fn add_joy_mapping_ex<'ex>( &'ex mut self, mapping: impl AsArg<GString> + 'ex, ) -> ExAddJoyMapping<'ex>

Adds a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices.

pub fn remove_joy_mapping(&mut self, guid: impl AsArg<GString>)

Removes all mappings from the internal database that match the given GUID. All currently connected joypads that use this GUID will become unmapped.

On Android, Godot will map to an internal fallback mapping.

pub fn is_joy_known(&self, device: i32) -> bool

Returns true if the system knows the specified device. This means that it sets all button and axis indices. Unknown joypads are not expected to match these constants, but you can still retrieve events from them.

pub fn get_joy_axis(&self, device: i32, axis: JoyAxis) -> f32

Returns the current value of the joypad axis at index axis.

pub fn get_joy_name(&self, device: i32) -> GString

Returns the name of the joypad at the specified device index, e.g. PS4 Controller. Godot uses the SDL2 game controller database to determine gamepad names.

pub fn get_joy_guid(&self, device: i32) -> GString

Returns an SDL2-compatible device GUID on platforms that use gamepad remapping, e.g. 030000004c050000c405000000010000. Returns an empty string if it cannot be found. Godot uses the SDL2 game controller database to determine gamepad names and mappings based on this GUID.

On Windows, all XInput joypad GUIDs will be overridden by Godot to __XINPUT_DEVICE__, because their mappings are the same.

pub fn get_joy_info(&self, device: i32) -> Dictionary<Variant, Variant>

Returns a dictionary with extra platform-specific information about the device, e.g. the raw gamepad name from the OS or the Steam Input index.

On Windows, Linux, and macOS, the dictionary contains the following fields:

raw_name: The name of the controller as it came from the OS, before getting renamed by the controller database.

vendor_id: The USB vendor ID of the device.

product_id: The USB product ID of the device.

steam_input_index: The Steam Input gamepad index, if the device is not a Steam Input device this key won’t be present.

On Windows, the dictionary can have an additional field:

xinput_index: The index of the controller in the XInput system. This key won’t be present for devices not handled by XInput.

Note: The returned dictionary is always empty on Android, iOS, visionOS, and Web.

pub fn should_ignore_device(&self, vendor_id: i32, product_id: i32) -> bool

Queries whether an input device should be ignored or not. Devices can be ignored by setting the environment variable SDL_GAMECONTROLLER_IGNORE_DEVICES. Read the SDL documentation for more information.

Note: Some 3rd party tools can contribute to the list of ignored devices. For example, SteamInput creates virtual devices from physical devices for remapping purposes. To avoid handling the same input device twice, the original device is added to the ignore list.

pub fn get_connected_joypads(&self) -> Array<i64>

Returns an Array containing the device IDs of all currently connected joypads.

pub fn get_joy_vibration_strength(&self, device: i32) -> Vector2

Returns the strength of the joypad vibration: x is the strength of the weak motor, and y is the strength of the strong motor.

pub fn get_joy_vibration_duration(&self, device: i32) -> f32

Returns the duration of the current vibration effect in seconds.

pub fn start_joy_vibration( &mut self, device: i32, weak_magnitude: f32, strong_magnitude: f32, )

To set the default parameters, use start_joy_vibration_ex and its builder methods. See the book for detailed usage instructions. Starts to vibrate the joypad. Joypads usually come with two rumble motors, a strong and a weak one. weak_magnitude is the strength of the weak motor (between 0 and 1) and strong_magnitude is the strength of the strong motor (between 0 and 1). duration is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely). The vibration can be stopped early by calling stop_joy_vibration.

Note: Not every hardware is compatible with long effect durations; it is recommended to restart an effect if it has to be played for more than a few seconds.

Note: For macOS, vibration is only supported in macOS 11 and later.

pub fn start_joy_vibration_ex<'ex>( &'ex mut self, device: i32, weak_magnitude: f32, strong_magnitude: f32, ) -> ExStartJoyVibration<'ex>

Starts to vibrate the joypad. Joypads usually come with two rumble motors, a strong and a weak one. weak_magnitude is the strength of the weak motor (between 0 and 1) and strong_magnitude is the strength of the strong motor (between 0 and 1). duration is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely). The vibration can be stopped early by calling stop_joy_vibration.

Note: Not every hardware is compatible with long effect durations; it is recommended to restart an effect if it has to be played for more than a few seconds.

Note: For macOS, vibration is only supported in macOS 11 and later.

pub fn stop_joy_vibration(&mut self, device: i32)

Stops the vibration of the joypad started with start_joy_vibration.

pub fn vibrate_handheld(&mut self)

To set the default parameters, use vibrate_handheld_ex and its builder methods. See the book for detailed usage instructions. Vibrate the handheld device for the specified duration in milliseconds.

amplitude is the strength of the vibration, as a value between 0.0 and 1.0. If set to -1.0, the default vibration strength of the device is used.

Note: This method is implemented on Android, iOS, and Web. It has no effect on other platforms.

Note: For Android, vibrate_handheld requires enabling the VIBRATE permission in the export preset. Otherwise, vibrate_handheld will have no effect.

Note: For iOS, specifying the duration is only supported in iOS 13 and later.

Note: For Web, the amplitude cannot be changed.

Note: Some web browsers such as Safari and Firefox for Android do not support vibrate_handheld.

pub fn vibrate_handheld_ex<'ex>(&'ex mut self) -> ExVibrateHandheld<'ex>

Vibrate the handheld device for the specified duration in milliseconds.

amplitude is the strength of the vibration, as a value between 0.0 and 1.0. If set to -1.0, the default vibration strength of the device is used.

Note: This method is implemented on Android, iOS, and Web. It has no effect on other platforms.

Note: For Android, vibrate_handheld requires enabling the VIBRATE permission in the export preset. Otherwise, vibrate_handheld will have no effect.

Note: For iOS, specifying the duration is only supported in iOS 13 and later.

Note: For Web, the amplitude cannot be changed.

Note: Some web browsers such as Safari and Firefox for Android do not support vibrate_handheld.

pub fn get_gravity(&self) -> Vector3

Returns the gravity in m/s² of the device’s accelerometer sensor, if the device has one. Otherwise, the method returns Vector3.ZERO.

Note: This method only works on Android and iOS. On other platforms, it always returns Vector3.ZERO.

Note: For Android, [member ProjectSettings.input_devices/sensors/enable_gravity] must be enabled.

pub fn get_accelerometer(&self) -> Vector3

Returns the acceleration in m/s² of the device’s accelerometer sensor, if the device has one. Otherwise, the method returns Vector3.ZERO.

Note this method returns an empty Vector3 when running from the editor even when your device has an accelerometer. You must export your project to a supported device to read values from the accelerometer.

Note: This method only works on Android and iOS. On other platforms, it always returns Vector3.ZERO.

Note: For Android, [member ProjectSettings.input_devices/sensors/enable_accelerometer] must be enabled.

pub fn get_magnetometer(&self) -> Vector3

Returns the magnetic field strength in micro-Tesla for all axes of the device’s magnetometer sensor, if the device has one. Otherwise, the method returns Vector3.ZERO.

Note: This method only works on Android and iOS. On other platforms, it always returns Vector3.ZERO.

Note: For Android, [member ProjectSettings.input_devices/sensors/enable_magnetometer] must be enabled.

pub fn get_gyroscope(&self) -> Vector3

Returns the rotation rate in rad/s around a device’s X, Y, and Z axes of the gyroscope sensor, if the device has one. Otherwise, the method returns Vector3.ZERO.

Note: This method only works on Android and iOS. On other platforms, it always returns Vector3.ZERO.

Note: For Android, [member ProjectSettings.input_devices/sensors/enable_gyroscope] must be enabled.

pub fn set_gravity(&mut self, value: Vector3)

Sets the gravity value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.

Note: This value can be immediately overwritten by the hardware sensor value on Android and iOS.

pub fn set_accelerometer(&mut self, value: Vector3)

Sets the acceleration value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.

Note: This value can be immediately overwritten by the hardware sensor value on Android and iOS.

pub fn set_magnetometer(&mut self, value: Vector3)

Sets the value of the magnetic field of the magnetometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.

Note: This value can be immediately overwritten by the hardware sensor value on Android and iOS.

pub fn set_gyroscope(&mut self, value: Vector3)

Sets the value of the rotation rate of the gyroscope sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.

Note: This value can be immediately overwritten by the hardware sensor value on Android and iOS.

pub fn set_joy_light(&mut self, device: i32, color: Color)

Sets the joypad’s LED light, if available, to the specified color. See also has_joy_light.

Note: There is no way to get the color of the light from a joypad. If you need to know the assigned color, store it separately.

Note: This feature is only supported on Windows, Linux, and macOS.

pub fn has_joy_light(&self, device: i32) -> bool

Returns true if the joypad has an LED light that can change colors and/or brightness. See also set_joy_light.

Note: This feature is only supported on Windows, Linux, and macOS.

pub fn get_last_mouse_velocity(&self) -> Vector2

Returns the last mouse velocity. To provide a precise and jitter-free velocity, mouse velocity is only calculated every 0.1s. Therefore, mouse velocity will lag mouse movements.

pub fn get_last_mouse_screen_velocity(&self) -> Vector2

Returns the last mouse velocity in screen coordinates. To provide a precise and jitter-free velocity, mouse velocity is only calculated every 0.1s. Therefore, mouse velocity will lag mouse movements.

pub fn get_mouse_button_mask(&self) -> MouseButtonMask

Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to mouse_get_button_state.

pub fn set_mouse_mode(&mut self, mode: MouseMode)

pub fn get_mouse_mode(&self) -> MouseMode

pub fn warp_mouse(&mut self, position: Vector2)

Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window.

Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if [enum MouseMode] is set to MouseMode::CONFINED or MouseMode::CONFINED_HIDDEN.

Note: warp_mouse is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.

pub fn action_press(&mut self, action: impl AsArg<StringName>)

To set the default parameters, use action_press_ex and its builder methods. See the book for detailed usage instructions. This will simulate pressing the specified action.

The strength can be used for non-boolean actions, it’s ranged between 0 and 1 representing the intensity of the given action.

Note: This method will not cause any input calls. It is intended to be used with is_action_pressed and is_action_just_pressed. If you want to simulate _input, use parse_input_event instead.

pub fn action_press_ex<'ex>( &'ex mut self, action: impl AsArg<StringName> + 'ex, ) -> ExActionPress<'ex>

This will simulate pressing the specified action.

The strength can be used for non-boolean actions, it’s ranged between 0 and 1 representing the intensity of the given action.

Note: This method will not cause any input calls. It is intended to be used with is_action_pressed and is_action_just_pressed. If you want to simulate _input, use parse_input_event instead.

pub fn action_release(&mut self, action: impl AsArg<StringName>)

If the specified action is already pressed, this will release it.

pub fn set_default_cursor_shape(&mut self)

To set the default parameters, use set_default_cursor_shape_ex and its builder methods. See the book for detailed usage instructions. Sets the default cursor shape to be used in the viewport instead of CursorShape::ARROW.

Note: If you want to change the default cursor shape for Control’s nodes, use [member Control.mouse_default_cursor_shape] instead.

Note: This method generates an InputEventMouseMotion to update cursor immediately.

pub fn set_default_cursor_shape_ex<'ex>( &'ex mut self, ) -> ExSetDefaultCursorShape<'ex>

Sets the default cursor shape to be used in the viewport instead of CursorShape::ARROW.

Note: If you want to change the default cursor shape for Control’s nodes, use [member Control.mouse_default_cursor_shape] instead.

Note: This method generates an InputEventMouseMotion to update cursor immediately.

pub fn get_current_cursor_shape(&self) -> CursorShape

Returns the currently assigned cursor shape.

pub fn set_custom_mouse_cursor( &mut self, image: impl AsArg<Option<Gd<Resource>>>, )

To set the default parameters, use set_custom_mouse_cursor_ex and its builder methods. See the book for detailed usage instructions. Sets a custom mouse cursor image, which is only visible inside the game window, for the given mouse shape. The hotspot can also be specified. Passing null to the image parameter resets to the system cursor.

image can be either Texture2D or Image and its size must be lower than or equal to 256×256. To avoid rendering issues, sizes lower than or equal to 128×128 are recommended.

hotspot must be within image’s size.

Note: AnimatedTextures aren’t supported as custom mouse cursors. If using an AnimatedTexture, only the first frame will be displayed.

Note: The Lossless, Lossy or Uncompressed compression modes are recommended. The Video RAM compression mode can be used, but it will be decompressed on the CPU, which means loading times are slowed down and no memory is saved compared to lossless modes.

Note: On the web platform, the maximum allowed cursor image size is 128×128. Cursor images larger than 32×32 will also only be displayed if the mouse cursor image is entirely located within the page for security reasons.

pub fn set_custom_mouse_cursor_ex<'ex>( &'ex mut self, image: impl AsArg<Option<Gd<Resource>>> + 'ex, ) -> ExSetCustomMouseCursor<'ex>

Sets a custom mouse cursor image, which is only visible inside the game window, for the given mouse shape. The hotspot can also be specified. Passing null to the image parameter resets to the system cursor.

image can be either Texture2D or Image and its size must be lower than or equal to 256×256. To avoid rendering issues, sizes lower than or equal to 128×128 are recommended.

hotspot must be within image’s size.

Note: AnimatedTextures aren’t supported as custom mouse cursors. If using an AnimatedTexture, only the first frame will be displayed.

Note: The Lossless, Lossy or Uncompressed compression modes are recommended. The Video RAM compression mode can be used, but it will be decompressed on the CPU, which means loading times are slowed down and no memory is saved compared to lossless modes.

Note: On the web platform, the maximum allowed cursor image size is 128×128. Cursor images larger than 32×32 will also only be displayed if the mouse cursor image is entirely located within the page for security reasons.

pub fn parse_input_event(&mut self, event: impl AsArg<Gd<InputEvent>>)

Feeds an InputEvent to the game. Can be used to artificially trigger input events from code. Also generates input calls.

var cancel_event = InputEventAction.new()
cancel_event.action = "ui_cancel"
cancel_event.pressed = true
Input.parse_input_event(cancel_event)

Note: Calling this function has no influence on the operating system. So for example sending an InputEventMouseMotion will not move the OS mouse cursor to the specified position (use warp_mouse instead) and sending Alt/Cmd + Tab as InputEventKey won’t toggle between active windows.

pub fn set_use_accumulated_input(&mut self, enable: bool)

pub fn is_using_accumulated_input(&self) -> bool

pub fn flush_buffered_events(&mut self)

Sends all input events which are in the current buffer to the game loop. These events may have been buffered as a result of accumulated input ([member use_accumulated_input]) or agile input flushing ([member ProjectSettings.input_devices/buffering/agile_event_flushing]).

The engine will already do this itself at key execution points (at least once per frame). However, this can be useful in advanced cases where you want precise control over the timing of event handling.

pub fn set_emulate_mouse_from_touch(&mut self, enable: bool)

pub fn is_emulating_mouse_from_touch(&self) -> bool

pub fn set_emulate_touch_from_mouse(&mut self, enable: bool)

pub fn is_emulating_touch_from_mouse(&self) -> bool

Methods from Deref<Target = Object>§

pub fn get_script(&self) -> Option<Gd<Script>>

pub fn set_script(&mut self, script: impl AsArg<Option<Gd<Script>>>)

pub fn connect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, ) -> Error

pub fn connect_flags( &mut self, signal: impl AsArg<StringName>, callable: &Callable, flags: ConnectFlags, ) -> Error

pub fn get_class(&self) -> GString

Returns the object’s built-in class name, as a String. See also is_class.

Note: This method ignores class_name declarations. If this object’s script has defined a class_name, the base, built-in class name is returned instead.

pub fn is_class(&self, class: impl AsArg<GString>) -> bool

Returns true if the object inherits from the given class. See also get_class.

var sprite2d = Sprite2D.new()
sprite2d.is_class("Sprite2D") # Returns true
sprite2d.is_class("Node")     # Returns true
sprite2d.is_class("Node3D")   # Returns false

Note: This method ignores class_name declarations in the object’s script.

pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)

Assigns value to the given property. If the property does not exist or the given value’s type doesn’t match, nothing happens.

var node = Node2D.new()
node.set("global_scale", Vector2(8, 2.5))
print(node.global_scale) # Prints (8.0, 2.5)

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get(&self, property: impl AsArg<StringName>) -> Variant

Returns the Variant value of the given property. If the property does not exist, this method returns null.

var node = Node2D.new()
node.rotation = 1.5
var a = node.get("rotation") # a is 1.5

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn set_indexed( &mut self, property_path: impl AsArg<NodePath>, value: &Variant, )

Assigns a new value to the property identified by the property_path. The path should be a NodePath relative to this object, and can use the colon character (:) to access nested properties.

var node = Node2D.new()
node.set_indexed("position", Vector2(42, 0))
node.set_indexed("position:y", -10)
print(node.position) # Prints (42.0, -10.0)

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant

Gets the object’s property indexed by the given property_path. The path should be a NodePath relative to the current object and can use the colon character (:) to access nested properties.

Examples: "position:x" or "material:next_pass:blend_mode".

var node = Node2D.new()
node.position = Vector2(5, -10)
var a = node.get_indexed("position")   # a is Vector2(5, -10)
var b = node.get_indexed("position:y") # b is -10

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

Note: This method does not support actual paths to nodes in the SceneTree, only sub-property paths. In the context of nodes, use get_node_and_resource instead.

pub fn get_property_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the object’s property list as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the property’s name, as a String;

  • class_name is an empty StringName, unless the property is VariantType::OBJECT and it inherits from a class;

  • type is the property’s type, as an int (see [enum Variant.Type]);

  • hint is how the property is meant to be edited (see [enum PropertyHint]);

  • hint_string depends on the hint (see [enum PropertyHint]);

  • usage is a combination of [enum PropertyUsageFlags].

Note: In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.

pub fn get_method_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns this object’s methods and their signatures as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the name of the method, as a String;

  • args is an Array of dictionaries representing the arguments;

  • default_args is the default arguments as an Array of variants;

  • flags is a combination of [enum MethodFlags];

  • id is the method’s internal identifier int;

  • return is the returned value, as a Dictionary;

Note: The dictionaries of args and return are formatted identically to the results of get_property_list, although not all entries are used.

pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool

Returns true if the given property has a custom default value. Use property_get_revert to get the property’s default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns false.

pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant

Returns the custom default value of the given property. Use property_can_revert to check if the property has a custom default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns null.

pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)

Adds or changes the entry name inside the object’s metadata. The metadata value can be any Variant, although some types cannot be serialized correctly.

If value is null, the entry is removed. This is the equivalent of using remove_meta. See also has_meta and get_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn remove_meta(&mut self, name: impl AsArg<StringName>)

Removes the given entry name from the object’s metadata. See also has_meta, get_meta and set_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant

To set the default parameters, use get_meta_ex and its builder methods. See the book for detailed usage instructions. Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetMeta<'ex>

Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool

Returns true if a metadata entry is found with the given name. See also get_meta, set_meta and remove_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_list(&self) -> Array<StringName>

Returns the object’s metadata entry names as an Array of StringNames.

pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)

To set the default parameters, use add_user_signal_ex and its builder methods. See the book for detailed usage instructions. Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn add_user_signal_ex<'ex>( &'ex mut self, signal: impl AsArg<GString> + 'ex, ) -> ExAddUserSignal<'ex>

Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given user-defined signal name exists. Only signals added with add_user_signal are included. See also remove_user_signal.

pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)

Removes the given user signal signal from the object. See also add_user_signal and has_user_signal.

pub fn emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Error

Emits the given signal by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see add_user_signal). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

Returns Error::ERR_UNAVAILABLE if signal does not exist or the parameters are invalid.

emit_signal("hit", "sword", 100)
emit_signal("game_over")

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object during idle time. Always returns null, not the method’s result.

Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they’ll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.

This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call_deferred("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

For methods that are deferred from the same thread, the order of execution at idle time is identical to the order in which call_deferred was called.

See also call_deferred.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

Note: If you’re looking to delay the function call by a frame, refer to the SceneTree.process_frame and SceneTree.physics_frame signals.

var node = Node3D.new()
# Make a Callable and bind the arguments to the node's rotate() call.
var callable = node.rotate.bind(Vector3(1.0, 0.0, 0.0), 1.571)
# Connect the callable to the process_frame signal, so it gets called in the next process frame.
# CONNECT_ONE_SHOT makes sure it only gets called once instead of every frame.
get_tree().process_frame.connect(callable, CONNECT_ONE_SHOT)
§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn set_deferred( &mut self, property: impl AsArg<StringName>, value: &Variant, )

Assigns value to the given property, at the end of the current frame. This is equivalent to calling set through call_deferred.

var node = Node2D.new()
add_child(node)

node.rotation = 1.5
node.set_deferred("rotation", 3.0)
print(node.rotation) # Prints 1.5

await get_tree().process_frame
print(node.rotation) # Prints 3.0

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn callv( &mut self, method: impl AsArg<StringName>, arg_array: &AnyArray, ) -> Variant

Calls the method on the object and returns the result. Unlike call, this method expects all parameters to be contained inside arg_array.

var node = Node3D.new()
node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571])

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_method(&self, method: impl AsArg<StringName>) -> bool

Returns true if the given method name exists in the object.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32

Returns the number of arguments of the given method by name.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given signal name exists in the object.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn get_signal_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the list of existing signals as an Array of dictionaries.

Note: Due to the implementation, each Dictionary is formatted very similarly to the returned values of get_method_list.

pub fn get_signal_connection_list( &self, signal: impl AsArg<StringName>, ) -> Array<Dictionary<Variant, Variant>>

Returns an Array of connections for the given signal name. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the connected Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn get_incoming_connections(&self) -> Array<Dictionary<Variant, Variant>>

Returns an Array of signal connections received by this object. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn disconnect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, )

Disconnects a signal by name from a given callable. If the connection does not exist, generates an error. Use is_connected to make sure that the connection exists.

pub fn is_connected( &self, signal: impl AsArg<StringName>, callable: &Callable, ) -> bool

Returns true if a connection exists between the given signal name and callable.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn has_connections(&self, signal: impl AsArg<StringName>) -> bool

Returns true if any connection exists on the given signal name.

Note: In C#, signal must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn set_block_signals(&mut self, enable: bool)

If set to true, the object becomes unable to emit signals. As such, emit_signal and signal connections will not work, until it is set to false.

pub fn is_blocking_signals(&self) -> bool

Returns true if the object is blocking its signals from being emitted. See set_block_signals.

pub fn notify_property_list_changed(&mut self)

Emits the property_list_changed signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.

pub fn set_message_translation(&mut self, enable: bool)

If set to true, allows the object to translate messages with tr and tr_n. Enabled by default. See also can_translate_messages.

pub fn can_translate_messages(&self) -> bool

Returns true if the object is allowed to translate messages with tr and tr_n. See also set_message_translation.

pub fn tr(&self, message: impl AsArg<StringName>) -> GString

To set the default parameters, use tr_ex and its builder methods. See the book for detailed usage instructions. Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_ex<'ex>(&'ex self, message: impl AsArg<StringName> + 'ex) -> ExTr<'ex>

Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_n( &self, message: impl AsArg<StringName>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString

To set the default parameters, use tr_n_ex and its builder methods. See the book for detailed usage instructions. Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn tr_n_ex<'ex>( &'ex self, message: impl AsArg<StringName> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExTrN<'ex>

Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn get_translation_domain(&self) -> StringName

Returns the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn set_translation_domain(&mut self, domain: impl AsArg<StringName>)

Sets the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn is_queued_for_deletion(&self) -> bool

Returns true if the queue_free method was called for the object.

pub fn cancel_free(&mut self)

If this method is called during ObjectNotification::PREDELETE, this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.

pub fn notify(&mut self, what: ObjectNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: ObjectNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Trait Implementations§

§

impl<'c, C> Deref for SignalsOfInput<'c, C>
where C: WithSignals,

§

type Target = <<Input as GodotClass>::Base as WithSignals>::SignalCollection<'c, C>

The resulting type after dereferencing.
§

fn deref(&self) -> &<SignalsOfInput<'c, C> as Deref>::Target

Dereferences the value.
§

impl<'c, C> DerefMut for SignalsOfInput<'c, C>
where C: WithSignals,

§

fn deref_mut(&mut self) -> &mut <SignalsOfInput<'c, C> as Deref>::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'c, C> Freeze for SignalsOfInput<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Freeze,

§

impl<'c, C> RefUnwindSafe for SignalsOfInput<'c, C>

§

impl<'c, C> Send for SignalsOfInput<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Send,

§

impl<'c, C> Sync for SignalsOfInput<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Sync,

§

impl<'c, C> Unpin for SignalsOfInput<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Unpin,

§

impl<'c, C> UnsafeUnpin for SignalsOfInput<'c, C>
where <C as WithSignals>::__SignalObj<'c>: UnsafeUnpin,

§

impl<'c, C> UnwindSafe for SignalsOfInput<'c, C>
where <C as WithSignals>::__SignalObj<'c>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.