Strange error then I assign array to dictionary key in the child node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RikKargones

So… My task is:
I have a dict what should contain an array. Something like what:

{key:[element0, element1]}

This dict located in script in Scene1 child node. Scene1 have a script too and assign an array to dict key in function.

func assign():

Then I call function assign() in Scene1 script (in _ready() for example), it works properly.
But when I add Scene1 to Scene2, and call Scene1’s function (assign()) from Scene2 child node again, game stops with what error:

Invalid set index 'key' (on base: 'Array') with value of type 'Array'

And sends to dict assign in function.

I don’t know what cause this. Could I miss something? Can I fix this without move code from child’s to Scene1’s script?

P.S. I’m from Russia and rarely use English. If something seems unclear in what issue, I can attach project file’s here.

Its just as the error says you’re trying to assign a string to an array index which is not allowed.

So your reference to $ChildNode.dict is either wrong or its an Array

Wakatta | 2021-02-07 20:49

I fix it. I made a silly mistake then I reset dict in a other part of script - by assigning an empty Array.

RikKargones | 2021-02-09 14:14