How Load png in user

Hello, I have a question because when I do a load with the user://ima.png path it tells me that the file does not exist

Loading the png to do what? Where?

You need the image in your project to work with it. Drag and drop should work…

Can you post your code?

No, what happens is that I have a saving system where each file has an image, although I know that it would be best to have it in the res:, I prefer to have it in the user next to the saved one.
Ah, that’s true, here is the file path is this:
\app_userdata\Game\Save Game
and the code and the code that calls the file:
$ColorRect2/Control/Sprite2D.set_texture(load("user://Save Game/ImgArchivo1.png")) $ColorRect2/Control/Sprite2D2.set_texture(load("user://Save Game/ImgArchivo2.png")) $ColorRect2/Control/Sprite2D3.set_texture(load"user://Save Game/ImgArchivo2.png"))
sorry for the inconvenience

That third line looks like a typo. Is that the problem?
load"user:

2 Likes

After toying around with this, I can’t seem to load() a texture from “user://” at all - maybe due to how Godot handles resources differently? If that’s the case, some sort of warning or error would be helpful - it always seems to return <Object#null> for me? Maybe something worth submitting to the github project?

I was able to grab a texture from the user folder like this though:

var image = Image.load_from_file("user://myfile.png")
var texture = ImageTexture.create_from_image(image)
$Sprite2D.texture = texture

See if that works?

Also, double-check if your images are truly in the user folder with this:
print(ProjectSettings.globalize_path(path_of_your_image))

1 Like

what a good idea, it works perfectly, thank you very much

1 Like