0 votes

I can't save a value of a dictionary at a specific time (like for a save system with multiple save slots). All slots just update with the variable they were copied from.

It looks like this:

var current_data = {"test": 1} "test" += 1 #every frame increase the value

var slots = {
"1" = {},
"2" = {},

After saving current_data to a slot (once, by pressing a button), the value in these slots keeps updating.

Here's link to a simple project with this problem:

in Engine by (37 points)
edited by

1 Answer

0 votes
Best answer

I found an answer - I had to use .duplicate() after the variable. It should say somewhere that this fuction can be used fort variables as well as for nodes :/ It would be less cofusing.

by (37 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.