This might be an easy question for you, guys, but I’m having trouble with it. How do you @export a Sprite2D properly? I created a CharacterBody2D scene called CardNumber. Inside that scene is a Sprite2D node. I then wrote in the code: @export var sprite: Sprite2D.
I then instantiated the CardNumber scene to the Main scene. What I want to do is duplicate the CardNumber, give each their respective sprite according to their number, and everyone’s happy. But dragging and dropping the PNG onto the Sprite inside the inspector does not work. How do you fix this?
If you want to reference .png file, you want to export a variable of type Texture2D.
Sprite2D is a type of node that uses a Texture2D to draw on the screen, while Texture2D is used to represent a 2D image.