#Set texture from file

2 messages · Page 1 of 1 (latest)

hallow ingot
#

This code below works when I drag'n'drop file that is already in project folder

func _ready():
    get_viewport().files_dropped.connect(on_files_dropped)

func on_files_dropped(files):
    var texture = load(files[0])
    texture_rect.texture = texture
    print(files)

and this works good setting new texture for TextureRect node. But when I give it file that is outside of project folder (like anywhere in windows filesystem) gd doesn't set anything to TextureRect setting current texture to empty. How can I fix this?