You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Matheus Lessa Rodrigues edited this page Oct 28, 2017
·
1 revision
PlayerPrefProperty
A series of classes that make it easy to use and change values of PlayerPref as if they were class fields.
Example
usingUnityEngine;usingBitStrap;publicsealedclassMyScript:MonoBehaviour{publicPlayerPrefIntmyIntPlayerPref=newPlayerPrefInt("TheKeyToMyPlayerPref");publicPlayerPrefStringmyStringPlayerPref=newPlayerPrefString("AnotherKeyToAnotherPlayerPref","SomeDefaultValue");publicPlayerPrefBoolmyBoolPlayerPref=newPlayerPrefBool("OneMoreKeyToMyPlayerPref");publicPlayerPrefFloatmyFloatPlayerPref=newPlayerPrefFloat("TheLastKeyToMyPlayerPref");privateStart(){myIntPlayerPref.Value=17;// Write values to PlayerPrefDebug.Log(myStringPlayerPref.Value);// Read values from PlayerPref}}