Material Box

Material Box

WEB Design & Material Images

Godot - Get sprite size

Godot

How to get sprite size in Godot 4 GDScript.


Can get sprite size with texture.get_size() from sprite node.
Returned size is array with width and height, influenced by Scale display size.

var sprite = get_node("Sprite")
var sprite_size = sprite.texture.get_size()
print(sprite_size)
# (80, 80)

Godot

TitleGodot - Get sprite size

CategoryGodot

Created

Update

AuthorYousuke.U