Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some data persistent over the scenes #8

Closed
vikaspro90 opened this issue Apr 21, 2017 · 1 comment
Closed

Make some data persistent over the scenes #8

vikaspro90 opened this issue Apr 21, 2017 · 1 comment
Assignees

Comments

@vikaspro90
Copy link
Owner

We need some data like the current level, number of levels to be consistent across the scenes meaning that it should persist even if the scene has changed.

@vikaspro90 vikaspro90 self-assigned this Apr 21, 2017
@vikaspro90
Copy link
Owner Author

Added a static class dataHolder in the assets that has all static variable/ methods. Only one copy of this data gets created once the application is started and remains until the end of execution. Manipulating the class data from other classes as needed.
Also made the sceneManager class static as it need not be assigned to any of the objects.
Cannot have any monobehaviour methods like start or update in this class.
(An alternative to this approach is to use an empty gameobject with a script with needed data. The gameobject needs to be used with donotdestroyonload. Can use monobehaviour methods.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant