- Home /
PlayerPrefs are global?
if I create a script of the PlayerPrefs can call directly in a separate file? or must be connected in some way?
Please restate your question in an understandable way. I don't think I get what you want to know.
Answer by mattssonon · Sep 04, 2013 at 02:43 PM
PlayerPrefs are global for the project, yes.
You can call, say, PlayerPrefs.GetString(key);
from any script in your project.
Answer by Seizure · Sep 04, 2013 at 03:07 PM
If you mean from a seperate project, or a different game then no it is not "Global", it is per project, so you could have GameA with PlayerPrefs.SetString"Test" and GameB with PlayerPrefs.SetString"Test" and these actual values be different.
Answer by robhuhn · Sep 04, 2013 at 02:46 PM
Yes PlayerPrefs are global and it has only static methods. You can call
in class A
PlayerPrefs.SetString("Player Name", "Foobar");
and in class B
print (PlayerPrefs.GetString("Player Name"));
See: http://docs.unity3d.com/Documentation/ScriptReference/PlayerPrefs.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613113551im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
performance wise, which is better..Playerprefs or global floats 3 Answers
Global Variables with Prefabs/ Self-Naming Variables 2 Answers
Global Variables: import script (boo) 2 Answers
If Statements with PlayerPrefs 1 Answer
BCE 0005 unknown identifier error when accessing global variable. 5 Answers