728x90 반응형 유니티11 [Unity] 유니티 단축키 모음 1. Hierarchy 오브젝트 활성화 / 비 활성화 : Alt + Shift + A 2. Hierarchy에서 Add Component 추가 : Ctrl + Shift + A 알아갈 때마다 계속 수정 될 예정 2021. 7. 26. [유니티] DontDestroyOnLoad 싱글톤 패턴 사용법 using UnityEngine; public class StartManager : MonoBehaviour { public static StartManager instance = null; void Awake() { // SoundManager 인스턴스가 이미 있는지 확인, 이 상태로 설정 if (instance == null) instance = this; // 인스턴스가 이미 있는 경우 오브젝트 제거 else if (instance != this) Destroy(gameObject); // 이렇게 하면 다음 scene으로 넘어가도 오브젝트가 사라지지 않습니다. DontDestroyOnLoad(gameObject); } } 2021. 6. 22. 이전 1 2 3 4 다음 728x90 반응형