using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement; // <- 꼭 추가
public class ZZZPractice : MonoBehaviour
{
float score = 1.23f;
void Start()
{
PlayerPrefs.SetFloat("BestScore", score); // "BestScore"라는 값에 score 데이터를 저장
PlayerPrefs.GetFloat("BestScore"); // "BestScore"라는 값에 저장된 데이터를 불러옴
}
}
PlayerPrefs.SetFloat("BestScore", score);
= "BestScore"라는 값에 score라는 실수형 데이터를 넣어
PlayerPrefs.GetFloat("BestScore");
= "BestScore"라는 값에 score라는 실수형 데이터를 가져와
'유니티' 카테고리의 다른 글
[유니티] 스크립트 작성 팁 - 변수는 최대한 함수 바깥에서 작성 (0) | 2024.12.24 |
---|---|
[유니티] 장면 전환 (0) | 2024.12.23 |
[유니티] 장면 Scene 불러오기 SceneManager.LoadScene (0) | 2024.12.22 |
[유니티] 문자열로 변환하기 (ToString) (1) | 2024.12.22 |
[유니티] 지연 호출 Invoke, InvokeRepeating 사용 방법 (0) | 2024.12.21 |