전체보기
-
원하는 생성 빈도에 따라 Enemy가 생성되게 하는 코드프로그래밍/Unity 2016. 9. 21. 08:08
using UnityEngine; using System.Collections; public class CEnemyGeneration : MonoBehaviour { public static CEnemyGeneration enemyGeneration; public Transform[] _enemyGenPosArray; // Enemy 생성 위치 배열 public GameObject[] _enemyArray; // 생성될 Enemy 배열 public float[] _enemyGenValue; // 각 Enemy의 생성 빈도 배열 public float _minDileyTime; public float _maxDileyTime; float RandomDileyTime; float TotalEnemyGenVa..
-
Resources폴더를 통한 (정적/동적) Instantiate 생성 코드프로그래밍/Unity 2016. 9. 5. 16:44
1. Resources 폴더를 스펠링 오타 없이 정확하게 생성 2. 해당 생성된 폴더 안에 생성하고자 하는 Prefab을 넣어 준다. 3. Resources.Load("Prefab 이름")으로 불러온 뒤 Instantiate로 생성 한다. 기존의 배열을 통하여 원하는 Prefab을 일일이 넣어주지 않아도 된다. 미리 할당 되있지 않아 메모리 낭비를 하지 않을 수 있는 장점이 있다. using UnityEngine; using System.Collections; using System.Collections.Generic; public class CGameManager : MonoBehaviour { public GameObject[] _playerPrefabs; // 정적 로드 생성 void StaticR..