using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameData : MonoBehaviour { public static GameData Instance { get; private set; } //public string username = "游客"; public string appleUserId = "123"; /// /// 是否是游客 /// public bool isYouke; private void Awake() { // 确保全局唯一 if (Instance != null && Instance != this) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); // 场景切换不销毁 } }