Version: 2022.3
言語: 日本語

PlayerPrefsException

class in UnityEngine

マニュアルに切り替える

説明

Web Player での容量制限を超えた場合、このエラーをスローするようになります。

設定ファイルに書き込みを行おうとしたときストレージ容量が足りない場合に例外をスローします。この例外は、他のプラットフォームではスローされません。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { // create a one megabyte character string string s16 = "0123456789abcdef"; string s1024 = ""; for (int j = 0; j < 64; j++) s1024 += s16; string s1024x1024 = ""; for (int i = 0; i < 1024; i++) s1024x1024 += s1024;

// try to save the string try { PlayerPrefs.SetString("fail", s1024x1024); } // handle the error catch (System.Exception err) { Debug.Log("Got: " + err); } } }

5.4.0 以降では、web player はサポートされないことに注意してください。