반응형
- 코드 작성
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;
}
}
}
반응형
'개발 > C#' 카테고리의 다른 글
C# 그리디 알고리즘 (Greedy 탐욕) 예시 간단 구현 (0) | 2023.10.20 |
---|---|
C# 버블, 선택, 삽입, 퀵 정렬 예시 간단 구현 (0) | 2023.10.20 |
유니티 C# 출석체크 7일 간단 구현 Unity Attendance (0) | 2023.10.16 |
유니티 C# UI 이미지 FillAmount 서서히 감소시키기 간단 구현 (0) | 2023.09.14 |
유니티 C# 슬롯머신 간단 구현 Unity Slot machine (0) | 2023.08.17 |
유니티 C# 캐릭터 주변 원 운동 오브젝트 간단 구현 및 데미지 주기 (0) | 2023.08.17 |
유니티 C# 맵 상에 직선 궤적 그리기 간단 구현 Line Renderer (0) | 2023.08.13 |
유니티 C# 배경 자동으로 움직이기 Background Scrolling (0) | 2023.08.13 |
댓글