-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
Description
Your Godot version:
Godot 4.1
Issue description:
The second code snippet does not work (export and setget):
extends Node2D
export (Texture) var texture setget _set_texture
func _set_texture(value):
# If the texture variable is modified externally,
# this callback is called.
texture = value # Texture was changed.
queue_redraw() # Trigger a redraw of the node.
func _draw():
draw_texture(texture, Vector2())
instead this works fine for me:
extends Node2D
@export var texture : Texture :
set(value):
texture = value
queue_redraw()
get:
return texture
func _draw():
draw_texture(texture,Vector2())
URL to the documentation page:
https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html