game object 타입의 배열 만들기.(게임 오브젝트 지정)

using UnityEngine;
using System.Collections;

public class Hero : MonoBehaviour {

public GameObject[] Ernemys; // 인스펙터 창에서 배열 표시
int score = 0;


// Use this for initialization
void Start () {

}


void OnMouseDown(){
Ernemys [score].GetComponent<Renderer>().material.color = Color.red;

if (score < 3) {
score ++;
}

}


// Update is called once per frame
void Update () {

}
}

댓글

이 블로그의 인기 게시물

날짜 시간 시간차 시간 계산 하기

코루틴에서 CallBack 함수 적용하기

C++ 언어 퍼센트 구하는 방법 / 기본 언어 퍼센트 구하는 방법