Godot Version
v4.3.stable.mono.official
Question
I’m trying to save and load GraphNodes. I can set various attributes on the nodes but when I try to set the position using the basic pattern in Saving games — Godot Engine (stable) documentation in English the value doesn’t change.
That is…
var newObjectScene = GD.Load<PackedScene>(nodeData["Filename"].ToString());
var newObject = newObjectScene.Instantiate<Node>();
GetNode(nodeData["Parent"].ToString()).AddChild(newObject);
//this line
newObject.Set(Node2D.PropertyName.Position, new Vector2((float)nodeData["PosX"], (float)nodeData["PosY"]));
…doesn’t do anything. I’ve tried casting the object to GraphNode and I’ve also tried with GlobalPosition and PositionOffset but nothing changes the value.
I thought that maybe there is some trick to this as the nodes are controlled by the GraphEdit object?