I am trying to make a game, which self-update.
I have a server with the up-to-date pck file for the entire game (it is small so it is OK to re-download it entirely when there is an update).
The game can detect that it has to reload the game (by comparing version number), and it downloads it into the "user://" filesystem.
When I load the game, it first run without knowing about the patch, so it loads the entire pck files that is next to the executable.
Then, it sees that "user://patch.pck" exists and loads it :
The content of patch.pck should replace everything that was into the first pck.
But I have a script "Global.gd" that is not replaced..
I suspect this is because of the cache system for resources. Since it has already been loaded, it uses the cached version. But here, the desired behaviour is to replace it.
How would you do ?
Here is the code that loads the script (first in the ready function, and then "reset" is called after the patch.pck has been loaded. I see that nothing in the Global variable changes.
var Global # Global variables that will be used by the game
# I load the script
var global_script = load("res://scripts/Global.gd")
# I delete any previously loaded Global Node
# I re-instance Global
Global = global_script.new()
Global.name = "Global"