Version: 2017.1

PlayerPrefs

class in UnityEngine

マニュアルに切り替える

説明

ゲームデータのセーブ、ロードなどを行います。

Editor/Standalone

On macOS PlayerPrefs are stored in ~/Library/Preferences folder, in a file named unity.[company name].[product name].plist, where company and product names are the names set up in Project Settings. The same .plist file is used for both Projects run in the Editor and standalone players.

On Windows, PlayerPrefs are stored in the registry under HKCU\Software\[company name]\[product name] key, where company and product names are the names set up in Project Settings.

Linux 上で PlayerPrefs は、~/.config unity3d[CompanyName]/[ProductName] に保存されています。company name および product name は Project Settings で設定します。

On Windows Store Apps, Player Prefs can be found in %userprofile%\AppData\Local\Packages\[ProductPackageId]>\LocalState\playerprefs.dat

Windows Phone 8 の Player Prefs は、アプリケーションのローカルフォルダーに保存されています。また、Windows.Directory.localFolder も参照してください。

On Android data is stored (persisted) on the device. The data is saved in SharedPreferences. C#/JavaScript, Android Java and Native code can all access the PlayerPrefs data. The PlayerPrefs data is physically stored in /data/data/pkg-name/shared_prefs/pkg-name.xml.

WebGL では、PlayerPrefs はブラウザーの IndexedDB API を使って保存されます。

Static 関数

DeleteAll設定情報からすべてのキーと値を削除します。注意して使用してください。
DeleteKey設定情報から key と対応する値を削除します。
GetFloatキーが存在する場合、key に対応する値を取得します。
GetIntキーが存在する場合、key に対応する値を取得します。
GetStringキーが存在する場合、key に対応する値を取得します。
HasKey key が設定に存在した場合、true を返します
Save変更された値をディスクへと保存します
SetFloat key で識別される設定情報の値を設定します。
SetInt key で識別される設定情報の値を設定します。
SetString key で識別される設定情報の値を設定します。