I'm following the Save/Load tutorial from document.
https://docs.godotengine.org/en/stable/tutorials/io/saving_games.html

I save player's location to dictionary like this:

var player_info = {"location": Vector3.ZERO,}

func _process(delta):
	player_info.location = self.global_transform.origin

My JSON file looks like this:

"location":"(-2.916666, 0.998771, 0)"

Then my Load function:

var new_object_location = node_data["location"]
new_object.transform.origin = new_object_location

I read you can use str_to_var / var_to_str for "location" and load it back as Vectors but I tried unsuccessfully to use it.
info: https://godotengine.org/qa/133608/how-to-save-load-vector2

Can anyone show me how to use it?

  • JusTiCe8 replied to this.
  • Gowydot I read you can use str_to_var / var_to_str for "location" and load it back as Vectors but I tried unsuccessfully to use it.

    AS it looks like you use Godot4, it's best to looks into the official documentation, there is a function to do what you need and many other.
    There is also a good demo for storage help.

    To bad demos are not well advertised, there are awesomely helpful with working code ready to be tested/used.

    Gowydot I read you can use str_to_var / var_to_str for "location" and load it back as Vectors but I tried unsuccessfully to use it.

    AS it looks like you use Godot4, it's best to looks into the official documentation, there is a function to do what you need and many other.
    There is also a good demo for storage help.

    To bad demos are not well advertised, there are awesomely helpful with working code ready to be tested/used.

    Solved! I need to add it to here:

    player_info.location = var_to_str(self.global_transform.origin)