Unity 数据存储与读取_PlayerPrefs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerInfo : MonoBehaviour {


    /// 
    /// 等级
    /// 
    public Text LevelText;
    /// 
    /// 昵称
    /// 
    public Text NameText;
    /// 
    /// 保存
    /// 
    public Button SaveBtn;
    /// 
    /// 读取
    /// 
    public Button LoadBtn;
	// Use this for initialization
	void Start () {

        //PlayerPrefs.DeleteAll();
     

        LevelText = GetByName("LevelText").GetComponent();
        NameText = GetByName("NameText").GetComponent();
        SaveBtn = GetByName("SaveBtn").GetComponent

PlayerPrefs适用范围

1. 适用设备:Mac OSX、Linux、Windows、
    Windows Store Apps、Windows Phone 8、Web players

2. 存储机制:Key-Value

3. 可存储变量类型:int、float、string

你可能感兴趣的:(Unity数据存储与读取)