Copy a scene variable

Hello i have to creat a scene variable for an object in my game with the same proprieties than an other i did before is it possible to take the code and copy it on the new variable ? it was for a random apparition on the ground

is it possible with load from json file?

sorry i don’t understand what do you want to do exactly, do you want to copy a variable?

i Can’t see my old scene variable that is my problem ^^

maybe if you show the code :thinking:

you think i have to code in the JSON file ?

no, the json file contains all the info gdevelop needs
I mean that you could show your code to know what happens

gdevelop these are the variable i would like to see they are in my code but not when i right click on the scene


this is all i can see

Ok I understand you know. Well in theory you should declare them with you do right click on the scene and go to Scene variables.
In practice I assign them a valua in action At the beginning of the Scene, and the variables never show in the windows mentioned before, but they are in the code.
I don’t know if this is a bug or not, but I “declare” them assigning a value in code not in the scene properties

i understand so how can i acces to the code and copy the propreties of the other to code the second one?

in your scene code use an event called At the beginning of scene, it runs only once when the scene starts, then on the actions side (the right) use set value of scene Variable ( or similar), you can copy and paste this events then change the variable name.
If you are copying from different projects open both with two instsnces of gdevelop and copy&paste from one to another

hum it s not working : ( cause when i change the variable name it change what it does and i want to save what it does and put what it does to another variable thats maybe impossible : /

hi,
i understand now what you want to do. Yes is not possible.
The only option is duplicate events and modify the variable name. :sweat_smile:
Maybe you can ask for it in the forum about improvements to gdevelop

1 Like