0 votes

I'm checking if a .png file was updated on the server and overwritting it if it's different from the server image, but it only updates if I close the game and start it again, even reloading scene don't work, am I misunderstanding something? Is it even possible?

in Engine by (38 points)

1 Answer

+3 votes
Best answer
func _ready():
    get_node("Sprite").set_texture(ResourceLoader.load("res://icon.png", "", true))
    get_node("Button").connect("pressed",get_tree(),"reload_current_scene")
by (9,702 points)
selected by

It still don't work. I edit the file locally, it correctly checks that the local file is different from the server one and download it, but ingame it still is the old image (even being updated at file manager)

did you reload current scene?
or did you reload texture and assign it again?
it's not updated magically when png is changed.

That's exactly what I want, When I run the game, I want it to check if a texture was changed on the server, if it is, I overwrite the local texture succesfully, I do reload the scene, but I can't manage to "reload and assign it again" while running, it saves the new texture on the file system but ingame it still uses the old texture.

I can't figure out what was wrong then.
I tested this code locally.
run game > change icon.png manually > click button to reload > I got new texture(icon.png)
there was no problem.

did you test with exported game?

Actually it worked with exported game, but with the editor it don't work until I click back on the editor and it updates that the file changed, when I go back and click the button to reload scene it works.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.