Dev Info/Unity (or C#)

C# 이모저모

DAID Games 2025. 8. 31. 22:28
Get 으로 List를 불러오면 매번 다시 읽어오나? = False
public class Test : MonoBehaviour
{
    public List<int> List
    {
        get
        {
            Debug.Log("Get List");
            return new() { 1, 2, 3, 4, 5 };
        }
    }
    private void Start()
    {
        foreach (var item in List)
        {
            Debug.Log($"item is {item}");
        }
    }
}