I wish to transfer an array to another scene and add the childrens to a following text

I wish to transfer an array to another scene and add it to a text,
You can choose how this will look but I generally just want to transfer array (or struct) to another scene and be able to show the answers onto another scene.

As this may look easy, remember that to go through a whole array, you’d also need something similar to the following code example (C#):

for(int i = 0; i < Arr.count(); i++){
       TextObject.Text += ToString(scene1.arrayvariable[i]);

Following picture is how it would be handwritten in other programming languages, I’m in gdevelop using block code so please remember that when explaining stuff in this thread!

If you use a global variable, it’s accessible in any scene. No transfering is required.

Normally, I’d use the for each child event but that only works for scene variables. Making a global version has been requested several times.

In your case, it would be easiest to use a repeat event (it’s one of the events in the + menu) and use a variable to go though the array.

This is exactly what I needed, thank you for understanding

1 Like