Answer the question
In order to leave comments, you need to log in
How to save data between scenes in unity?
Immediately I say I'm an amateur ...
I wrote these lines to save the data (health, damage, etc.) for the next scene. I attached this script (InfoData), for example, to the main camera (I tried it and not to it)
The button (which, if pressed, causes damage) refers to the main camera (because there is a script with the necessary data in it.)
BUT when the scene changes, this button will not access anything
And so in all buttons, animations, etc.
The data is saved, but I can’t access it, because the buttons do not see the main camera of the FIRST scene, and the SECOND main camera has completely disappeared (but it’s not needed, because it contains old data).
In what ways can I use the same data in different scenes?
If you save everything else (for example, throw the script into the canvas, where all the buttons and pictures are) too, then I already save everything, and all my scenes become the same.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question