Y
Y
yraiv2020-05-04 12:36:42
Unity
yraiv, 2020-05-04 12:36:42

How to access a script variable if it's in another scene?

What are the ways to implement getting script variables if it is in another scene (dontdestroy is not an option)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Dyupachev, 2020-05-05
@yraiv

You can use global variables or save variables to disk in a file when you close the scene, and then load from this file when you open a new scene. Or use the singleton pattern, which is essentially the same as using global variables.

X
xmoonlight, 2020-05-04
@xmoonlight

Use a storage array at the very top of the application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question