본문 바로가기
Unity3D/Unity & C#

Unity & C# ~ List<Class> 형식

by 캬캬백곰 2022. 6. 16.
728x90

List<class> 예시

위의 이미지와 같은 List 형식을 만드는 방법

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ExampleList : MonoBehaviour
{
    public ListExample listExample = new ListExample();

}

[Serializable]
public class ListExample
{
    public List<ExampleGuide> id;

    public ListExample()
    {
        id = new List<ExampleGuide>();
    }
}

[Serializable]
public class ExampleGuide
{
    public int id;
    public string name;
    public float value;
    public List<int> list;

    public ExampleGuide()
    {
        list = new List<int>();
    }
}
728x90
반응형