public static GameManager instance;
private void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
์ฌ ์ ํ์ ํด๋น ์ค๋ธ์ ํธ๋ฅผ ํ๊ดดํ์ง ์๊ณ ์ ์งํ๋ค.
* DontDestroyOnLoad๋ ๋ฃจํธ ๊ฒ์์ค๋ธ์ ํธ์ ์ปดํฌ๋ํธ๋ค์๋ง ์ ์ฉ๋๋ค.
ex) ์บ๋ฒ์ค์ UI ์ค๋ธ์ ํธ๋ค์๋ ๋ฏธ์ ์ฉ
'๐น๏ธ Unity' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| ๋ฐ์นผ (Decal) (0) | 2024.07.03 |
|---|---|
| ์๋ค๋จธ์ ์นด๋ฉ๋ผ ๋จ๋ฆผ (์งํฐ๋ง) ํ์ (0) | 2024.07.03 |
| ๋ ๋ ํ์ดํ๋ผ์ธ (Render Pipeline) (0) | 2023.10.16 |
| ์ค๋ธ์ ํธ์ ์๋ ์ขํ, ์คํฌ๋ฆฐ ์ขํ ๋ณํํ๊ธฐ (0) | 2023.09.21 |
| PlayerPrefs (0) | 2023.09.21 |