- Edited
Perhaps I'm missing something right in front of my eyes but I'm a little confused. I'm making a character creator of sorts ... so I have 3 dictionaries. 1 to hold the choices the player is making 2 for the confirmed player stats 3 for the confirmed npc stats
So when the player clicks the button, I want to transfer all the Dic1 data to one of the other dictionaries to make a character. My problem is, after I've copied 1 dictionary to another, any time I edit one of the 1st dictionaries values the one I'm not editing seems to change as well.
Sorry if that sounds a little confusing but I made a simplified test to confirm my suspicions.
var p = {age = "1"}
var s = {age = "2"}
var t = {age = "3"}
func _on_Button_pressed():
p = t
print(p)
print(s)
print(t)
func _on_Button2_pressed():
t.age = "4"
s = t
print(p)
print(s)
print(t)
The first button works fine but when I press button 2, even though I did nothing to Dictionary P
, it still prints 4. Am I doing something obviously wrong? Does "x.key" Go through every key in every dictionary? I don't know why "p" is changing when I press button2.