using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerInfo : MonoBehaviour {
/// <summary>
/// 等级
/// </summary>
public Text LevelText;
/// <summary>
/// 昵称
/// </summary>
public Text NameText;
/// <summary>
/// 保存
/// </summary>
public Button SaveBtn;
/// <summary>
/// 读取
/// </summary>
public Button LoadBtn;
// Use this for initialization
void Start () {
//PlayerPrefs.DeleteAll();
LevelText = GetByName("LevelText").GetComponent<Text>();
NameText = GetByName("NameText").GetComponent<Text>();
SaveBtn = GetByName("SaveBtn").GetComponent<Button>();
//匿名委托 保存玩家等级和昵称
SaveBtn.onClick.AddListener(
() => {
PlayerPrefs.SetInt("Level
Unity 数据存储与读取_PlayerPrefs
最新推荐文章于 2023-08-02 16:16:48 发布
本文介绍了Unity中的PlayerPrefs数据存储机制,它适用于Mac, Linux, Windows等多个平台,采用Key-Value方式存储,并能处理int、float、string类型的变量。通过PlayerPrefs,开发者可以方便地在游戏运行时进行数据的保存和读取。"
139271473,4848549,安卓固件深入解析:vendor.img分区的修改与作用,"['安卓开发', '系统分区', '驱动程序', '设备定制', '固件修改']
摘要由CSDN通过智能技术生成