+1 vote


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.

extends Node

var Global # Global variables that will be used by the game

func _ready():

func reset():
    # I load the script
    var global_script = load("res://scripts/Global.gd")

    # I delete any previously loaded Global Node
    if has_node("Global"):

    # I re-instance Global
    Global = global_script.new()
    Global.name = "Global"  
    add_child(Global, true)
asked May 26 in Engine by socomajor (18 points)

Please log in or register to answer this question.

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.