๐Ÿ“š Tech

    [Unity] ํ™œ์šฉ ๊ฐ€๋Šฅํ•œ AI ์ฝ”๋”ฉ ์„œ๋น„์Šค 1ํŽธ

    [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..

    [C#] struct ๋Œ€์‹  class๋ฅผ ์จ์•ผ ํ•  ๋•Œ

    struct ๋Œ€์‹  class๋ฅผ ์จ์•ผ ํ•  ๋•Œ ๊ฐ„๋‹จํ•œ ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ๋ฅผ ํ‘œํ˜„ํ•  ๋•Œ ์ข…์ข… struct๋ฅผ ์‚ฌ์šฉํ•˜๊ณค ํ•œ๋‹ค. ์ด๋•Œ ํ•จ์ˆ˜ ์•ˆ์—์„œ ์‚ฌ์šฉ๋˜๋Š” struct๋Š” Value ํƒ€์ž…์œผ๋กœ ์Šคํƒ์— ์ƒ์„ฑ๋˜๊ณ , class๋Š” Reference ํƒ€์ž…์œผ๋กœ ์ธ์Šคํ„ด์Šค๊ฐ€ ํž™์— ์ƒ์„ฑ๋œ๋‹ค. ์ด๋Ÿฌํ•œ ๊ตฌ์กฐ์ ์ธ ์ฐจ์ด๋Š” ๋•Œ๋กœ ๋ฒ„๊ทธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ณค ํ•œ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ˆ์ œ๊ฐ€ ์žˆ๋‹ค. struct Employee { public string Name { get; set; } public int Salary { get; set; } } class HR { public void RaiseSalary(Employee emp) { emp.Salary = emp.Salary + 1000; } } Employee emp = new Employee(); emp.Nam..

    [C#] string ๊ฐ์ฒด ์‚ฌ์šฉ์—์„œ ํ”ํžˆ ํ•˜๋Š” ์‹ค์ˆ˜

    string ๊ฐ์ฒด ์‚ฌ์šฉ์—์„œ ํ”ํžˆ ํ•˜๋Š” ์‹ค์ˆ˜ ํ•œ ๋ฉ”์„œ๋“œ ์•ˆ์˜ ๋กœ์ปฌ ๋ณ€์ˆ˜๋“ค์€ ๊ทธ ๋ฉ”์„œ๋“œ๊ฐ€ ๋๋‚  ๋•Œ ํ•ด์ œํ•˜๊ฒŒ ๋œ๋‹ค. Value ํƒ€์ž…์˜ ๋ณ€์ˆ˜๋Š” ํ•จ์ˆ˜ ๋ฆฌํ„ด๊ณผ ๋™์‹œ์— ์Šคํƒ์—์„œ ํ•ด์ œ๋˜๊ณ , Reference ํƒ€์ž…์˜ ๋ณ€์ˆ˜๋Š” GC์— ์˜ํ•ด ํž™์—์„œ ์ž๋™ ํ•ด์ œ๋œ๋‹ค. ์—ฌ๊ธฐ์„œ ํ”ํžˆ ํ•˜๋Š” ์‹ค์ˆ˜ ์ค‘ ํ•˜๋‚˜๋Š” ๋ ˆํผ๋Ÿฐ์Šค ํƒ€์ž…์˜ ๊ฐ์ฒด๋ฅผ ๋ถˆํ•„์š”ํ•˜๊ฒŒ ๋„ˆ๋ฌด ๋งŽ์ด ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์•„๋ž˜ ์˜ˆ์ œ๋Š” string ๊ฐ์ฒด๋ฅผ n๊ฐœ ์”ฉ ๊ณ„์† ์ƒ์„ฑํ•˜๊ณ  ์žˆ๋‹ค. public string Get1ToN_Bad(int n) { string s = ""; for (int i = 1; i

    [C# 8.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (3) - using ์„ ์–ธ, ๋„ ๋ณ‘ํ•ฉ ํ• ๋‹น์ž, ๊ตฌ์กฐ์ฒด ์ฝ๊ธฐ ์ „์šฉ ๋ฉค๋ฒ„

    C# 8.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ 5. using ์„ ์–ธ using ์„ ์–ธ์€ using ๋’ค์— ์žˆ๋Š” ๋ณ€์ˆ˜๊ฐ€ using์„ ๋‘˜๋Ÿฌ์‹ผ ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚  ๊ฒฝ์šฐ Dispose ํ•˜๋„๋ก ์ปดํŒŒ์ผ๋Ÿฌ์—๊ฒŒ ์ง€์‹œํ•˜๊ฒŒ ๋œ๋‹ค. Dispose๋Š” ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋ฉฐ ๋” ์ด์ƒ ์ด ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์“ฐ์ง€ ์•Š๊ณ , ๊ด€๋ จ ๋ฆฌ์†Œ์Šค๋ฅผ ์ •๋ฆฌํ•œ๋‹ค๋Š” ๋œป์ด๋‹ค. ๋ฉ”์„œ๋“œ๊ฐ€ ๋๋‚  ๋•Œ Dispose๋ฅผ ์ž๋™ ํ˜ธ์ถœํ•œ๋‹ค. private void GetDataCS8() { using var reader = new StreamReader("src.txt"); string data = reader.ReadToEnd(); Debug.WriteLine(data); // ์—ฌ๊ธฐ์„œ Dispose() ํ˜ธ์ถœ๋จ } 6. ๋„ ๋ณ‘ํ•ฉ ํ• ๋‹น์ž(Null Coalescing Assignment) ํ”ํžˆ NULL..

    [C# 8.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (2) - Nullable Reference Type, ์ธ๋ฑ์‹ฑ๊ณผ ์Šฌ๋ผ์ด์‹ฑ

    C# 8.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ 3. Nullable Reference Type ์ด์ „ ๋ฒ„์ „์—์„œ๋Š” reference ํƒ€์ž…์— null์„ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ์–ด Null Reference Exception์ด ์ž์ฃผ ๋ฐœ์ƒ๋˜๊ณค ํ–ˆ๋‹ค. ๊ทธ๋ž˜์„œ C# 8.0์—์„œ๋Š” reference ํƒ€์ž…์— null์„ ํ• ๋‹นํ•˜๋ฉด ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๊ฒฝ๊ณ ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€๋˜์—ˆ๋‹ค. reference ํƒ€์ž…์€ ๊ธฐ๋ณธ์ ์œผ๋กœ null์„ ๋„ฃ์„ ์ˆ˜ ์—†๋Š” Non-nullable Reference Type์ด ๋˜๊ณ , NULL์„ ํ—ˆ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ ˆํผ๋Ÿฐ์Šค ํƒ€์ž… ๋’ค์— ๋ฌผ์Œํ‘œ(?)๋ฅผ ๋ถ™์—ฌ Nullable Reference Type์ž„์„ ํ‘œ์‹œํ•ด์•ผ ํ•œ๋‹ค. Nullable Reference Type ๊ธฐ๋Šฅ์€ ๋””ํดํŠธ๋กœ Disable ๋˜์–ด ์žˆ์œผ๋ฉฐ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ”„๋กœ์ ํŠธ ๋ ˆ๋ฒจ์ด๋‚˜ ํŒŒ์ผ ๋ ˆ๋ฒจ, ํ˜น์€ ์†Œ..

    [C# 8.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (1) - ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„, ํŒจํ„ด ๋งค์นญ

    C# 8.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„(Default Inteface Members) ํŒจํ„ด ๋งค์นญ Nullable Reference Type ์ธ๋ฑ์‹ฑ๊ณผ ์Šฌ๋ผ์ด์‹ฑ ๋น„๋™๊ธฐ ์ŠคํŠธ๋ฆผ using ์„ ์–ธ ๋„ ๋ณ‘ํ•ฉ ํ• ๋‹น์ž ๊ตฌ์กฐ์ฒด ์ฝ๊ธฐ ์ „์šฉ ๋ฉค๋ฒ„ ์ •์  ๋กœ์ปฌ ํ•จ์ˆ˜ ๋ฌธ์ž์—ด ๋ณด๊ฐ„ ํ† ํฐ๊ณผ @ ํ† ํฐ ์ˆœ์„œ Unmanaged constructed type https://www.csharpstudy.com/Latest/CS8-def-itf-mem.aspx C# 8 ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„ - C# ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฐ์šฐ๊ธฐ (Learn C# Programming) C# 8 : ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„ ๊ตฌํ˜„ (Default Inteface Members) ์ง€๊ธˆ๊นŒ์ง€ (C# 8.0 ์ด์ „) C#์—์„œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ•œ๋ฒˆ ๋ฐฐํฌํ•œ ํ›„, ๊ทธ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ..