Makes sure that data from a scene is saved outside the scene to be used in other scenes?

I know the title is confusing but I’m gonna try my best to explain my request.

In the game I’m trying to make I want that once the player entered his name I could use that part (the name part) in other scenes, but it seems that I can’t do that in the “logical way”. The text entry not being present in another scene I’m unable to giveout the “textentry.string()” in other places.
Does anybody have an idea, or alternative that would work ?

Textentry is an object specific to a scene so you cannot use the expression textentry in another scene than the scene where the textentry object is.

in order to find your data from one scene to another, the best, the most convenient, is to store it in a global variable.

So in the scene where the player enter his name, you set global variable “name” as textentry.

In other scenes you can then access the player name by GlobalVariableString(name)

2 Likes

Save the TextEntry in your game Storage then in the next scene you retrieve the saved name from the Storage.
like


In your other scene just add the second event at the begin of the Scene so you read the storage and assign that value to a scene variable then just use the Game.TheName

1 Like

Hi thank you for your answer !
But could you develop for how to use again the value in other scene I don’t quite get it. Thank you

Suppose you have a scene where the player puts his name called SelectName(Scene) there you use those events to save the name that player writes in the Storage.


The important part here is the Write thing, maybe you need to adapt this when the player hits Return or in a button click, then you save with Write in Storage.

Now you have another scene for example GameScene(Scene) in this scene you only put the Read from Storage event and assign the scene variable to Game.TheName

And thats all you need.

1 Like