- Home /
score passed between scenes
Hey guys,
I have a PlayerGamePrefs script in a scene that loads the PlayerPreferences and assigns the values to variables. But in another scene, I can't access these variables. The variables are public static, but I can't access them without errors. Is there an easy way to pass these values across scenes?
Thanks.
I would suggest posting your script or at least a part of it so we can have an idea of what is going wrong.
Answer by Ferb · Jan 21, 2014 at 06:50 PM
Have you called DontDestroyOnLoad during the script to make sure that the gameobject containing it will still exist when another scene is loaded? I think that's necessary to get variables passed into the next scene. http://docs.unity3d.com/Documentation/ScriptReference/Object.DontDestroyOnLoad.html
Your answer
Follow this Question
Related Questions
Store Multiple values in one variable 2 Answers
How to assign a Variable with a Raycast 1 Answer
print(); to console problem - beginner 0 Answers
GUI.DrawTexture Error & Static Variables!! 2 Answers
Problem with variables 1 Answer