godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.14k stars 19.95k forks source link

Texture does not update in running game if changed in project. Game needs to be restarted. #93629

Open Arnklit opened 1 month ago

Arnklit commented 1 month ago

Tested versions

4.3.beta2

System information

Godot v4.3.beta2 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU (NVIDIA; 31.0.15.4633) - AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (16 Threads)

Issue description

Textures don't update in running game if you change the texture file. So you have to restart the game. I would expect it to reload the texture when it changes.

Steps to reproduce

https://github.com/godotengine/godot/assets/4955051/41bfffad-7867-4539-b118-e239d1a791f1

Minimal reproduction project (MRP)

NA

AThousandShips commented 1 month ago

This is expected, textures are imported and the running game doesn't update this until it's reimported and reloaded

But especially I'd say it's not expected that the textures in the running scene reload when changed like this in the running game

Arnklit commented 1 month ago

As I understand it, we do this with other resources. When we notice they change we reload them in the running game. Script reloading for example.

AThousandShips commented 1 month ago

That I think is because of live editing features, what happens if you reload the scene in the running project?

This would probably require more features added to the engine, unsure, but I don't expect this to be a missed check somewhere but that a dedicated system is needed

Arnklit commented 1 month ago

I think we can close this and I can open it as a proposal instead if that makes more sense.

AThousandShips commented 1 month ago

I think we can let it be a bit and see if there's more info available, I haven't tested or dug around in the code to verify and it's just a hunch on my side that this is not expected to work

KoBeWi commented 1 month ago

You can reload the texture without restarting if you do it manually. E.g. you can restart your scene, so the assets get loaded again and the texture is reloaded (though it won't work if the texture is cached somewhere; it has to be unloaded completely). You can also use ResourceReloader's CACHE_MODE_REPLACE to force reloading the texture. It doesn't require restarting the scene.