반응형
- 코드 작성
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SaveByte : MonoBehaviour {
public static void SaveByteArrayToPlayerPref(byte[] data)
{
string dataString = System.Convert.ToBase64String(data);
PlayerPrefs.SetString("Key", dataString);
PlayerPrefs.Save();
Debug.Log("Key Data Save");
}
public static byte[] LoadByteArrayToPlayerPrefs()
{
string dataString = PlayerPrefs.GetString("Key");
if(!string.IsNullOrEmpty(dataString))
{
byte[] data = System.Convert.FromBase64String(dataString);
Debug.Log("Key Data Load");
return data;
}
else
{
Debug.Log("Data is Null");
return null;
}
}
}
반응형