상세 컨텐츠

본문 제목

[C#] 배열

유니티

by simstealer 2022. 7. 7. 10:52

본문

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

public class HelloCode : MonoBehaviour
{
    void Start()
    {
        int[] student = new int[5]; // 자료형 앞에 [] 대괄호를 써서 배열이란걸 알려주자

        student[0] = 1;
        student[1] = 2;
        student[2] = 3;
        student[3] = 4;
        student[4] = 5;

        for (int i = 0; i < student.Length; i++)
        {
            Debug.Log(student[i]);
        }
    }

}

'유니티' 카테고리의 다른 글

[C#] string  (0) 2022.07.07
[Unity] 이벤트 함수의 실행 순서  (0) 2022.07.07
[Unity] 클래스 인스턴스의 참조 값 변경해보기  (0) 2022.07.07
[Unity] Log  (0) 2022.07.07
[Unity] 직선의 거리 구하기  (0) 2022.07.07

관련글 더보기

댓글 영역