Keep same score variable in all scenes


my question is, if it is possible to keep a score variable in all of my scenes and increase it or reduce it in my different scripts.

I would suggest to add a script to handle the whole game state.
In this script you can define score and any other variables.

Then add this script to root entity. So, afterwards you can get your score by

1 Like

I think i don’t understand.What do you mean root entity?
In that way i can control my score in each scene and keep my score for the other scenes?

As long as you’re using JS, you can extend any object.

So, just add a score variable in and you can get it in any scene.

Thank you again.
Is there any example link that i can follow?

Oh, just = 0;;

That’s all;

@mikefinch How did you do this exactly? I am not getting how you get a variable between scenes.