Keep a variable between panel change
Hello,
I have a 2d game with a few panels, that contain some menus but I'm more interested in resolving that transfer of values between 3 panels. I have a TOP PANEL that stays active all the time that has a text called INCOME (has a script). I have Panel 1 with some buttons and by pressing one of the buttons we go into Panel 2. In Panel 2 we have two Game Objects each one with it's own script that give some values over time. Those 2 values are summed together in the INCOME text script (which is a part of the top panel which is always active). While I'm in the Panel 2 the summed INCOME in the TOP PANEL runs as it is supposed to run, but the second I press return to go to Panel 1, the summed INCOME freezes. How can I transfer this Summed INCOME between Panel 2 and Panel 1?
Thank you
[1]: /storage/temp/193230-capture.jpg
capture.jpg
(22.6 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613053554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Change a variable in a different object? 1 Answer
If statement unexpectedly changing value. 0 Answers
Managing In-Game Variables of Different Data Types 1 Answer
Disable function in another script 1 Answer
Trying to understand variables 2 Answers