반응형
- 데이터 저장
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
private void SetValue()
{
PlayerPrefs.SetFloat("Apple", 1.0f);
PlayerPrefs.SetInt("Orange", 1);
PlayerPrefs.SetString("Banana", "Banana");
}
}
- 데이터 불러오기
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
private void GetValue()
{
float apple = PlayerPrefs.GetFloat("Apple");
int orange = PlayerPrefs.GetInt("Orange");
string banana = PlayerPrefs.GetString("Banana");
}
}
반응형
'개발 > C#' 카테고리의 다른 글
유니티 C# 반복문 for, foreach, While 문 간단 사용법 (0) | 2022.06.30 |
---|---|
유니티 C# 조건문 if, else, Swtich 문 간단 사용법 (0) | 2022.06.30 |
유니티 C# Application 관련 API 사용법 모음 (0) | 2022.06.21 |
유니티 C# 이벤트 델리게이트 delegate Event 간단 사용법 (0) | 2022.06.21 |
유니티 C# 타이머 만들기 시분초 00:00:00 Timer (0) | 2022.06.21 |
유니티 C# 충돌 처리 OnTrigger Enter, Stay, Exit 간단 사용법 (0) | 2022.06.21 |
유니티 C# 코루틴 동작, 시간 딜레이 Coroutine, Invoke 간단 사용법 (0) | 2022.06.21 |
유니티 C# 씬 로드 동기, 비동기 간단 사용법 Load Scene Async (0) | 2022.06.21 |
댓글