https://shlifedev.gitbook.io/unitygooglesheets/
Unity Google Sheet - UGS 개발문서
WebGL, Linux, Windows, Android(Il2cpp/AOT), iOS, Xbox,Ps4와 같은 모든 플랫폼을 지원합니다.
shlifedev.gitbook.io
위는 구글스프레드시트를 프로젝트에 적용시킬 수 있는 Asset이다. 무료로 사용할 수 있다.
보통 게임 데이터 저장/로드할 때, CSV, Json, Scriptable Object등 사용되는데, 구글 스프레드 시트또한 사용될 수 있다.
구글 스프레드 시트와 이 Asset을 사용했을때 장
점으로는 온라인으로 스프레드 시트를 협업하는 사람들 모두가 참조, 변경할 수 있기 때문에 협업에서 효율적으로 데이터를 관리할 수 있다. 또한 Asset의 사용법이 아주 쉽고, 한글로 된 공식문서도 지원을 해 빠르게 익힐 수 있다.
단점으로는 데이터를 로드, 세이브 할 때도 구글 스프레드 시트를 사용하기 때문에 온라인 연결이 필요하다. 프로젝트를 진행할 때는 거의 문제가 될 일이 없겠지만, 프로젝트 완성 후 배포를 한 후가 문제가 될 것 같다.
그 이유는 게임 내 데이터를 관리하는 시트를 참조하기 위해선 인터넷 연결이 필요하고, 만약에 유저 개별 데이터를 저장할 때도 이 Asset을 쓴다면 따로 구글 스프레드 시트가 필요하는 등 사실상 게임 자체에서의 Save 기능은 사용하기 힘들다고 생각한다.
물론 프로젝트 진행 중에서는 정말 편리하고 유용한 에셋이라 생각한다.
아래는 CardData와 CardTable 스크립트로, CardData class로 CardData를 정의하고,
CardTable class는 CardData가 있는 구글 스프레드 시트를 통해 데이터를 불러오고, 게임 상에서 적용시킬 수 있다.
public class CardData
{
public int ID;
public string Name;
public int RequestDiceCount;
public string Effect;
public string DiceCondition;
public int CanRepaetCount;
public CardData(int id, string name, int requestDiceCount, string effect, string diceCondition, int canRepaetCount)
{
this.ID = id;
this.Name = name;
this.RequestDiceCount = requestDiceCount;
this.Effect = effect;
this.DiceCondition = diceCondition;
this.CanRepaetCount = canRepaetCount;
}
}
public class CardTable : MonoBehaviour
{
public static CardTable Inst { get; private set; }
void Awake()
{
Inst = this;
CardsData.Data.Load();
}
public CardData ReturnCardData(int id)
{
CardData cardData = new CardData(id, GetCardName(id), GetRequestDiceCount(id), GetCardEffect(id), GetDiceCondition(id), GetCanRepeatCount(id));
return cardData;
}
public int GetCanRepeatCount(int id)
{
var localMap = CardsData.Data.GetDictionary();
return localMap[id].CanRepeatCount;
}
public string GetCardName(int id)
{
var localMap = CardsData.Data.GetDictionary();
if (localMap[id].Name == null )
{
return null;
}
else
{
return localMap[id].Name;
}
}
public int GetRequestDiceCount(int id)
{
var localMap = CardsData.Data.GetDictionary();
return localMap[id].NeedDiceCount;
}
public string GetCardEffect(int id)
{
var localMap = CardsData.Data.GetDictionary();
if (localMap[id].Effect == null)
{
return null;
}
else
{
return localMap[id].Effect;
}
}
public string GetDiceCondition(int id)
{
var localMap = CardsData.Data.GetDictionary();
return localMap[id].DiceCondition;
}
}
하지만 만들고나서 느낀게
결국 게임을 배포할 때, 게임 데이터를 담은 CSV(또는 Json등)을 사용할텐데, 그러면 구글스프레드 시트를 csv로 바꿔야한다. 그러면 이때 csv에서 Data를 읽고 쓰는것과 구글 스프레드시트(와 이 asset)에서 똑같이 할 수 있는지(클래스의 큰 변경없이) 궁금해졌다. 다음시간에 알아보자
'Unity Engine' 카테고리의 다른 글
missingreferenceexception Error occurs when load Scene (0) | 2023.04.09 |
---|---|
Flast White, Shader (0) | 2023.04.02 |
Input System (0) | 2023.03.19 |
Singleton Class & Manager Class (0) | 2023.03.18 |
접근제한자, Property (0) | 2023.03.16 |