Files
2026-07-14 11:51:45 +09:00

27 lines
683 B
C#

using UnityEngine;
public class GameManager : MonoBehaviour,ISceneInitializable
{
public static GameManager Instance { get; private set; }
public GameObject Player {get; private set;}
public PlayerController PController => Player != null ? Player.GetComponent<PlayerController>() : null;
private void Awake()
{
if (Instance == null)
{
Instance = this; //만들어진 자신을 인스턴스로 설정
}
else
{
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
}
}
public void OnSceneLoaded()
{
Player = GameObject.FindWithTag("Player");
}
}