Computer Language/유니티
out 을 이용하여 메인에서 배열을 써봅시다.
알 수 없는 사용자
2014. 5. 9. 21:32
using UnityEngine;
using System.Collections;
public class Fill{
public void FillArray(out int[] arr)
{
arr = new int[5] {1, 2, 3, 4, 5} ;
}
}
public class Pro : MonoBehaviour {
// Use this for initialization
void Start () {
int[] theArray;
Fill fill=new Fill();
//Fill.FillArray(out theArray);
fill.FillArray(out theArray);
print ("Array element are:13131");
for( int i = 0; i < theArray.Length; i++)
{
print("TheArray[i]= "+theArray[i] + " ");
}
print ("exit");
}
// Update is called once per frame
void Update () {
}
}