S
S
Saidburkhon Shukhratov2020-12-19 14:49:27
C++ / C#
Saidburkhon Shukhratov, 2020-12-19 14:49:27

How to change variables from another script if they are in different scenes?

I have bool variable in script1. and there is a script2 that changes the value of bool (In script1) if you click on the button. I would be able to do this if they were in the same scene, but they are in different scenes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bogdan Erolskiy, 2020-12-19
@PRO100PRO

You can use PlayerPrefs by storing key data in one script and then accessing that data anywhere in the application.
If you need to save not just an int, float or string variable - ArrayPrefs2
Or use a static class variable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question