๐ Game/โ Unity
![[Unity] null ์ฒดํฌ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbzh1Cf%2FbtsGYl35mBv%2F3bWhYLlylXV8JeAXKahpNk%2Fimg.png)
[Unity] null ์ฒดํฌ
1. UnityEngine.Object == null๊ฐ๋ฐ ์ ๊ฐ์ฒด๊ฐ ์ค์ ๋ก ์กด์ฌํ๋์ง ํ์ธํ๊ธฐ ์ํด == null ์ฒดํฌ๋ฅผ ์์ฃผ ์ฌ์ฉํ๊ณค ํ๋ค. ๊ณผ์ฐ ์ด ๋ฐฉ๋ฒ์ด ์ต์ ์ผ๊น? 2. fake null"UnityEngine.Object == null์์์ null์ด ์ง์ง null์ด ์๋๋ค! ์ฆ, fake null์ด๋ค"๋ผ๋ ๋ง์ด ์กด์ฌํ๋ค. ์ ๊ทธ๋ด๊น? ์์ธ์ ์ ๋ํฐ์์์ null๊ณผ System์์์ null์ ์ฐจ์ด์ด๋ค. ์ด ์ฐจ์ด๋ฅผ ์์๋ณด๊ธฐ ์ํด ๋ค์๊ณผ ๊ฐ์ด ์ฝ๋๋ฅผ ์คํํ๋ฉด, UnityEngine.Object์ System.Object์ null ์ฒดํฌ ๊ฐ์ด ๋ค๋ฅธ ๊ฒ์ ํ์ธํ ์ ์๋ค. var obj = new GameObject();yield return null; Destroy(obj);yield return nu..
[Unity] ์ฝ๋ ๋ด ํ ๋ฉ๋ชจ๋ฆฌ ์ต์ ํ
์ฝ๋ ๋ด ํ ๋ฉ๋ชจ๋ฆฌ ์ต์ ํ ํ๋ก๊ทธ๋จ์ ๋ง๋ค ๋ ํ ๋ฉ๋ชจ๋ฆฌ ์์ญ์ ํ๋ก๊ทธ๋๋จธ๊ฐ ํญ์ ์ ๊ฒฝ ์จ์ผ ๋๋ ์ค์ํ ๋ฉ๋ชจ๋ฆฌ ์์ญ์ด๋ค. ์ ๋ํฐ์์ ํ ๋ณ์๊ฐ ์์ฑ๋ ๋ ์ฌ์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ์ง ์๋ค๋ฉด GC์ ์ํํ๋ค. ํ์ง๋ง GC์ ๊ฝค๋ ๋ฌด๊ฑฐ์ด ์์ ์ด๊ธฐ ๋๋ฌธ์ ์ด ์๊ฐ ํ๋ ์ ๋๋กญ์ด ๋ฐ์ํ๋ค. ์ด๋ฅผ ๊ฐ์ ํ๊ธฐ ์ํด ์ต๊ทผ์๋ Inscremental GC ๊ธฐ๋ฅ์ด ์ ๋ฐ์ดํธ๋๊ธด ํ์์ง๋ง, ๊ทธ๋๋ GC์ ๋์์ด ๋๋ ํ ํ ๋น์ ์ต๋ํ ๋ง๋ค์ง ์๋ ๊ฒ์ด ์ข๋ค. 1) ์์ฃผ ์ฌ์ฉ๋๋ ์ฐธ์กฐ ๋ณ์๋ ์บ์ฑํ๊ธฐ private Button btn; void Start() { btn = GetComponent(); } public void MyMethod() { //Button btn = GetComponent(); // ํจ์ ํธ์ถ์ ๋ง๋ค ํ ..
![[Unity] Mathf.Lerp() ํจ์](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbPT15p%2Fbtsc2ouH4ZD%2FBsOgmD7xk43tyk54kMOEg1%2Fimg.png)
[Unity] Mathf.Lerp() ํจ์
Lerp 1. ๊ฐ๋ ์ ํ ๋ณด๊ฐ(Linear Interpolation)์ ๋ ์ (a, b) ์ฌ์ด์ ๊ฐ(c)์ ๊ตฌํ๊ธฐ ์ํด ๋ ์ ์ ์ฐ๊ฒฐํ ์ง์ ์ ๋ง๋ค์ด ์ฌ์ด ๊ฐ(t)์ ๊ณ์ฐํ๋ ๋ฐฉ๋ฒ์ด๋ค. Mathf.Lerp(float a, float b, float t) ์ฌ๊ธฐ์ t๋ percet(0 ~ 1)์ ๊ฐ๋ ์ด๊ธฐ ๋๋ฌธ์ t = 0์ด๋ฉด a, t = 1์ด๋ฉด b์ ๊ฐ๋ค. 2. ์ ๋ํฐ ํ์ฉ 1) ๋ถ๋๋ฌ์ด ์์ง์ ๋ถ๋๋ฌ์ด ์์ง์์ ํํํ๊ธฐ ์ํด Update()์์ ๋ ์ ์ฌ์ด์ ๊ตฌ๊ฐ์ ์ง์์ ์ผ๋ก ์ด๋์์ผ ํ์ฉํ ์ ์๋ค. Update() ํจ์๊ฐ ํธ์ถ๋๋ ๋งค ํ๋ ์๋ง๋ค ์์น๋ ๊ณ์ ์์ง์ผ ๊ฒ์ด๊ณ ๋ชฉํ ์ง์ ์ ๊ทผ์ ํ ์๋ก ๋์ฑ ๋ถ๋๋ฌ์ด ์์ง์์ ๋ํ๋ด๊ฒ ๋๋ค. void Update() { a = Mathf.Lerp(a, b, 0...
![[Unity] ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 2ํธ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FqMph2%2Fbtr7iMtOley%2FzkWoO9TUh2NvHCT9IwtRIK%2Fimg.png)
[Unity] ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 2ํธ
ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 2. Github Copilot Github Copilot์ ์๋ ์ฝ๋ ์์ฑ ์ธ๊ณต์ง๋ฅ์ด๋ค. ๊นํ๋ธ์ ์๋ ์๋ง์ ๋ ํฌ์งํ ๋ฆฌ๋ค์ ํ์ตํ์ฌ ์ฃผ์์ด๋ ํจ์๋ฅผ ์๋์ผ๋ก ์์ฑํด ๋จ์ํ๊ณ ๋ฒ๊ฑฐ๋ก์ด ์์ ๋ค์ ์๋ํํ ์ ์๋ค. https://github.com/features/copilot?utm_source=youtube&utm_medium=social&utm_campaign=unitylive-jan_unitytips_aicoding GitHub Copilot · Your AI pair programmer GitHub Copilot works alongside you directly in your editor, suggesting whole lines or entire function..
![[Unity] ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 1ํธ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbgKFss%2Fbtr5NKFB3Cs%2FtqdSegve2IyrBr4efB6xl1%2Fimg.png)
[Unity] ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 1ํธ
ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 1ํธ 1. ChatGPT ChatGPT๋ฅผ ์ด์ฉํ์ฌ ์ ๋ํฐ C# ์คํฌ๋ฆฝํธ๋ฅผ ์ง๋๋ก ํ์ฉํ ์ ์๋ค. https://openai.com/blog/chatgpt?utm_source=youtube&utm_medium=social&utm_campaign=unitylive-jan_unitytips_aicoding Introducing ChatGPT We’ve trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer followup questions, admit its mistakes, challenge inc..
[Unity] ๋ชจ๋ฐ์ผ ๊ฒ์ ์ฑ๋ฅ ์ต์ ํ 2ํธ
๋ชจ๋ฐ์ผ ๊ฒ์ ์ฑ๋ฅ ์ต์ ํ 2ํธ 1. ์์ ํ์ผ wav ์๋ณธ ์ฌ์ฉ ์ด์ฐจํผ ์ ๋ํฐ์์ ๋ค์ ์์ถ์ ํด์ฃผ๊ธฐ ๋๋ฌธ์ mp3๋ฅผ ์ผ์ ๋์ ์ด๋์ ํ๋ก์ ํธ์ ์ฉ๋์ด ์ค์ด๋ ๋ค๋ ๊ฒ ๋ฐ์ ์๋ค. ๊ทธ๋ ๋ค๊ณ ์ด๋ฏธ ์์ถ๋ mp3๋ฅผ wav๋ก ๋ฐ๊ฟ ํ์๋ ์๋ค. 2. ํ ์ค์ณ, 3D Mesh์ Read/Write Enabled ์ฒดํฌ๋ฐ์ค ๋นํ์ฑํ CPU์์ GPU๋ก ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฎ๊ธฐ๊ณ CPU์์๋ ๋ด๋ฆฐ๋ค. ํ์ฑํํ ๊ฒฝ์ฐ์๋ CPU์์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ด๋ฆฌ์ง ์์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ค๋ณต๋๋ค. ํ ์ค์ณ๋ฅผ ๋์ ์ผ๋ก ์กฐ์ํ๋ค๋ฉด ๋น์ฐํ ์ผ์ผ ํ์ง๋ง, ์๋๋ผ๋ฉด ๋นํ์ฑํํ๋ ๊ฒ์ด ์ข๋ค. 3. ํ๋ฉด ํด์๋ ์กฐ์ Screen.SetResolution(width, height, false); 4. Renderer.material ์ ๊ทผ ์ฃผ์ Renderer.materia..