Howdy. I've been following the saving games docs page and when loading, any members of the "Persist" group get instanced at position (0,0).
I read somewhere about setting positions prior to calling
AddChild, and so swapped the lines around in the load function but it doesn't seem to make any difference. I have also tried using
GlobalPosition instead of
Position but again, no dice.
The relevant section of my "load" function (unchanged from the docs page example) looks like this:
while (saveGame.GetPosition() < saveGame.GetLen())
// Get the saved dictionary from the next line in the save file
var nodeData = new Godot.Collections.Dictionary<string, object>((Godot.Collections.Dictionary)JSON.Parse(saveGame.GetLine()).Result);
// Firstly, we need to create the object and add it to the tree and set its position.
var newObjectScene = (PackedScene)ResourceLoader.Load(nodeData["Filename"].ToString());
var newObject = (Node)newObjectScene.Instance();
newObject.Set("Position", new Vector2((float)nodeData["PosX"], (float)nodeData["PosY"]));
All variables seem to be fine if I GD.print them and the savegame file looks fine:
Where might I be going wrong here?