728x90
기본형태
public class GameManager : MonoBehaviour
{
public static GameManager Instance;
public GameObject fatCat;
public GameObject nomalCat;
void Awake()
{
Application.targetFrameRate = 60;
}
private void Start()
{
InvokeRepeating("SpawnCat", 0.0f, 1.0f);
}
void SpawnCat()
{
float x = Random.Range(-9.0f, 9.0f);
float y = 30.0f;
int rand = Random.Range(0, 5);
if (rand > 3)
{
Instantiate(fatCat, new Vector2(x, y), Quaternion.identity);
}
else
{
Instantiate(nomalCat, new Vector2(x, y), Quaternion.identity);
}
}
}
'UNITY > Unity Study' 카테고리의 다른 글
| Unity 인터페이스 탐색과 기초 조작법 (0) | 2025.05.28 |
|---|---|
| UNREAL/UE 5.4 웨비나 - 2주차 - 라이트 (0) | 2024.05.09 |
| 큐브 옮기기 게임 - Unity 3D (3) | 2023.09.06 |
| 시간내에 목적지 도달하기 (0) | 2023.08.30 |
| FurBall의 탈출기 (0) | 2023.08.23 |