개발/Unity
[Unity] 2차원 배열 inspector 창에서 보여주기
슐리반
2020. 8. 19. 16:16
안녕하세요 슐리반입니다.
Unity에서 2차원 배열을 inspector창에 띄우는 코드에 대해 알아보겠습니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable] //반드시 필요
public class MapArray //행에 해당되는 이름
{
public GameObject[] map;
}
public class Game : MonoBehaviour //메인 클래스
{
public MapArray[] stageArray; //열에 해당되는 이름
}
행과 열에 명확한 구분을 위해
Map과 Stage로 이름을 지었습니다.