전체 글113 [Unity] Unity Life Cycle Awake : 스크립트가 실행될 때 한번만 호출 됨 OnEnable : 객체가 활성화 될 때마다 호출 됨 Start : 한번 생성된 객체는 OnEnable → Update로 흘러감 Update : 프레임마다 호출되는 함수 LateUpdate : Update가 호출되고 나서 한 번씩 호출 FixedUpdate : 발생하는 주기 일정 0.02초 OnDisable : 객체가 비활성화 됐을 때 호출 OnDestroy 🎮Unity 2022. 12. 12. [C#][Programmers] 대문자와 소문자 문자열 my_string이 매개변수로 주어질 때, 대문자는 소문자로 소문자는 대문자로 변환한 문자열을 return하도록 solution 함수를 완성해주세요. using System; public class Solution { public string solution(string my_string) { string answer = ""; //대소문자 판별하여 //대소문자 변환 foreach(char item in my_string) { if(Char.IsUpper(item) == true) { answer += Char.ToLower(item); } else { answer += Char.ToUpper(item); } } return answer; } } Char.IsUpper() / Char.IsLowe.. 👩💻Programming/Coding Test 2022. 12. 12. [C#] Char.IsNumber / IsDigit https://learn.microsoft.com/ko-kr/dotnet/api/system.char.isnumber?view=net-7.0 Char.IsNumber 메서드 (System) 유니코드 문자가 숫자인지 여부를 나타냅니다. learn.microsoft.com 유니코드 문자가 숫자인지 여부를 나타냅니다. 반환 : bool (true/false) https://learn.microsoft.com/ko-kr/dotnet/api/system.char.isdigit?view=net-7.0 Char.IsDigit 메서드 (System) 유니코드 문자가 10진수인지 여부를 나타냅니다. learn.microsoft.com 유니코드 문자가 10진수인지 여부를 나타냅니다. 반환 : bool (true/false.. 👩💻Programming/C# 2022. 12. 11. [C#][Programmers] 모음 제거 영어에선 a, e, i, o, u 다섯 가지 알파벳을 모음으로 분류합니다. 문자열 my_string이 매개변수로 주어질 때 모음을 제거한 문자열을 return하도록 solution 함수를 완성해주세요 using System; public class Solution { public string solution(string my_string) { string answer = ""; string[] moeum = {"a","e","i","o","u"}; foreach(var item in moeum) { my_string = my_string.Replace(item,""); } answer = my_string; return answer; } } 이렇게 했는데 Regex.Replace를 사용하는 경우 Rege.. 👩💻Programming/Coding Test 2022. 11. 28. [Unity] Coroutine, Invoke 코루틴 일정한 간격 후 한 행동을 실행해야 하는 경우 하나의 루틴에서 여러 번 반복적으로 필요한 경우 게임 오브젝트의 상태가 비활성화될 시 코루틴 정지 단일 스레드에서 멀티 스레드의 효과 파라미터를 넘길 수 있음 // 다음 프레임 까지 대기 yield return null // 지정된 초동안 대기 yield return new WaitForSeconds(float) //다음 고정 프레임까지 대기 yield return new WaitForFixedUpdate() //모든 렌더링이 끝날 때까지 대기 yield return new WaitForEndOfFrame() //특정 코루틴 함수가 끝날 때까지 대기 yield return StartCoroutine(string) // 웹 통신 작업이 끝날 때까지 대기.. 🎮Unity 2022. 11. 28. [C#][Programmers] 배열의 유사도 두 배열이 얼마나 유사한지 확인해보려고 합니다. 문자열 배열 s1과 s2가 주어질 때 같은 원소의 개수를 return하도록 solution 함수를 완성해주세요. for문 사용시 using System; public class Solution { public int solution(string[] s1, string[] s2) { int answer = 0; for(int i = 0; i 👩💻Programming/Coding Test 2022. 11. 26. [C#] Math 메서드 https://learn.microsoft.com/ko-kr/dotnet/api/system.math?view=net-7.0 Math 클래스 (System) 삼각, 로그 및 기타 일반 수학 함수에 대한 상수 및 정적 메서드를 제공합니다. learn.microsoft.com Abs 절대값 반환 Ceiling 올림 Floor 내림 Round 반올림 Max 더 큰 수 Min 더 작은 수 Pow 거듭제곱 Sqrt 제곱근 👩💻Programming/C# 2022. 11. 26. [C#][Programmers] 제곱수 판별하기 어떤 자연수를 제곱했을 때 나오는 정수를 제곱수라고 합니다. 정수 n이 매개변수로 주어질 때, n이 제곱수라면 1을 아니라면 2를 return하도록 solution 함수를 완성해주세요. using System; public class Solution { public int solution(int n) { int answer = 0; double tmp = Math.Sqrt((double)n); answer = tmp % 1 == 0 ? 1 : 2; return answer; } } using System; public class Solution { public int solution(int n) { int answer = Math.Sqrt(n) % 1 == 0 ? 1 : 2; return answer; .. 👩💻Programming/Coding Test 2022. 11. 26. [C#][Programmers] 문자 반복 출력 문자열 my_string과 정수 n이 매개변수로 주어질 때, my_string에 들어있는 각 문자를 n만큼 반복한 문자열을 return 하도록 solution 함수를 완성해보세요. using System; public class Solution { public string solution(string my_string, int n) { string answer = ""; string[] words = new string[my_string.Length]; for(int i = 0; i < my_string.Length; i++) { words[i] = new string(my_string[i],n); answer += words[i]; } return answer; } } using System; publ.. 👩💻Programming/Coding Test 2022. 11. 26. [Unity] Addressables Addressables The Addressables system provides tools and scripts to organize and package content for your application and an API to load and release assets at runtime. When you make an asset "Addressable," you can use that asset's address to load it from anywhere. Whether that asset resides in the local application or on a content delivery network, the Addressable system locates and returns it. A.. 🎮Unity 2022. 11. 16. [C#][programmers] 최댓값 만들기 1 정수 배열 numbers가 매개변수로 주어집니다. numbers의 원소 중 두 개를 곱해 만들 수 있는 최댓값을 return하도록 solution 함수를 완성해주세요. using System; public class Solution { public int solution(int[] numbers) { int answer = 0; Array.Sort(numbers); answer = numbers[numbers.Length-1]*numbers[numbers.Length-2]; return answer; } } using System; using System.Linq; public class Solution { public int solution(int[] numbers) { numbers = numbers.. 👩💻Programming/Coding Test 2022. 11. 10. [C#][programmers] 배열 원소의 길이 문자열 배열 strlist가 매개변수로 주어집니다. strlist 각 원소의 길이를 담은 배열을 retrun하도록 solution 함수를 완성해주세요. using System; public class Solution { public int[] solution(string[] strlist) { int[] answer = new int[strlist.Length]; for(int i = 0; i < strlist.Length; i++) { answer[i] = strlist[i].Length; } return answer; } } string.Length로 문자열의 길이를 알 수 있다. Char로 변환하지 않아도 됨 / 변환시 같은 결과 👩💻Programming/Coding Test 2022. 11. 10. 이전 1 2 3 4 5 6 ··· 10 다음