player 데이터 싱글톤 구조로 변경

This commit is contained in:
aube.lee
2025-02-01 21:41:59 +09:00
parent 1a870dde42
commit 0b201267bf
4 changed files with 43 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
public class PlayerDataManager : SingletonBase<PlayerDataManager>
{
// 사용자가 생성해둔 플레이어 데이터를 싱글톤으로 전역 사용하기 위함
public List<PlayerData> players { get; private set; }
protected override void Awake()
{
base.Awake();
LoadPlayerData();
}
private void LoadPlayerData()
{
players = JSONLoader.LoadFromResources<List<PlayerData>>("Player");
if (players == null)
{
players = new List<PlayerData>();
Debug.LogError("⚠️ Player data loading failed. Check if 'Player.json' exists in Resources folder.");
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f52606f26bff734428ec67cdb89e0330
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: