Click or drag to resize

SpriteGetRect Method

Returns a Rect2 representing the Sprite's boundary in local coordinates. Can be used to detect if the Sprite was clicked. Example:

func _input(event):
    if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT:
        if get_rect().has_point(to_local(event.position)):
            print("A click!")

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Rect2 GetRect()

Return Value

Type: Rect2

[Missing <returns> documentation for "M:Godot.Sprite.GetRect"]

See Also