[SOLVED] Add child array via events

I was sure this

Will add NEW child to array with value 222
But it does not

I have childs 0 1 and 2 index
So index 3 and 4 are shown as 0

So what i expected to happen is when i press z key it will change child with index 3 to 222
But it does not do it

Am i doing something wrong or it is not for that?

And if so then is it possible to add new child via events to existing array?

On the first frame, the first line is displaying the values of array indexes that haven’t been created yet. So, index 0-4 get set to zero. Check the debugger because I believe the 5th index is probably 222.

1 Like

I had created only these 3 variables

So did guess any further variable like index 3 and 4 did not exist yet

IF you meant that they are created with value 0 because i did print them to text object
Then you are correct
i did this

So it is displayed AFTER new child is added and well
I say it did the trick


1 Like

You’re welcome. It’s a bit annoying that just checking a variable can create it but I guess it’s better than it crashing because it doesn’t exist.

When that happens, I kind of wish an error could be displayed in the preview or debugger. Just so we know.

Schrödinger’s variable

1 Like