Is there something like a node ID which is specific to that node and will be the same no matter how often I execute the game? That would be super useful for saving and loading games.

  • jlothamer
    link
    fedilink
    arrow-up
    1
    ·
    11 months ago

    I’ve thought about this problem creating a system to save game state. The issue with assigning a UUID works until you have dynamic scenes added to the game at runtime. The nodes in those scenes will all have the same UUID. In the end I ended up just using the paths and saving the fact that the scene that data is being saved for is dynamic. Then the system sees this and re-instances the scene and adds it back to the tree. (A slight adjustment to the path must be made as Godot will create nodes with the at (@) symbol in them, but you can’t do that yourself.)

    You can see this in action at my demo repo on github.