Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MasterBor |
Hello !
I imported several images to the project (just drugged some jpg to folder in environment).
I want to load one of them to the TextureRect (for instance).
Godot 3.1
Very simple code:
extends TextureRect
func _ready():
load_image()
func load_image():
var texture = ImageTexture.new()
texture.load("res://Images/myPic.jpg")
self.texture = texture
In godot it works but I getting this error:
Loaded resource as image file, this will not work on export:
‘res://Images/myPic.jpg’. Instead, import the image file as an Image
resource and load it normally as a resource.
What am I doing wrong ?
How should I load these pictures from the code ?