Instance_id not working for LoadSave functions

Godot Version

4.2

Question

I am trying to learn how to load and save data on scene changes. Right now, I just want to save and load enemy health, and global_position. I made a resource called EnemyData. Then made a global script for the Load and Save functions. the part I am struggling with is the node_id. It saves the node_id into the JSON file along with everything else, but in the load_function when I try to get the specific node based on the ID, it says the node with the ID doesn’t exist.




output

The instance ID is only useful at runtime in the same session, when the game is restarted the instance IDs will change.

1 Like

Could I assign each slime it’s own custom ID kind of by naming it?
what I did is in my main world scene, it gets all slimes in the group enemies, then gives it a name “Slime” + counter. and the counter is increased by one every time it loops.

I was calling the Load function in the wrong place. I had to call it in the _ready funciton of the World Scene

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.