Hi, I’m trying to make a game and I found the help I got from here last time very helpful so try again with another problem
Background info:
In one level the player will be able to choose two skills among many to use in the game.
The skills are placed on the screen as buttons with GUI textures.
The skill-stats chosen in the first level should be transferred to each of the skill buttons.
The player has a script where the skills are used.
= 3 scripts:
choose skill
player attack
skill button (technically it’s 2 scripts, 1 for each button)
Problem:
How could this be done most simply?
Stats to be moved:
I think what you really need is a class that does not destroy itself when you load another scene.
Then you want to save all your information into that class so you can pass it around the unity game engine and access it.
Then you can create a script class, store everything you want in the game object.
In your main menu, can create that game object…
Attach your script class to it…
Set all your values in your script as needed.
Then as you load different screens you wont actually lose your information.
By default the unity engine destroys all game objects between scenes…
But this great little function if called on a transform tells it not too…
So that game object will be maintained as well as any scripts attached to it…
and they will maintain their set properties.
This is what i do also. i have a little empty game object with a script that contains all the data i want to pass between scenes.
then just call the DontDestroyOnLoad when you change scene. so you can just read the data you want from the object in your new scene