분류 전체보기 493

[Unity] 유니티 오브젝트 Fake Null과 Null 처리

Fake Null 우리는 유니티 게임 오브젝트를 파괴하기 위해서 UnityEngine.Object를 GameObject.Destroy();를 통해 오브젝트가 메모리를 해제한다. UnityEngine.Object클래스는 C++ 유니티 엔진 코드에 존재하는 NativeObject객체에 포인터를 가지고 있는 C++객체를 감싸 포함하고 있는 C#클래스이다. C++은 메모리를 포인터로 관리하고 C#은 가비지컬렉션이 메모리해제를 관리하며 이 차이점 때문에 Fake Null이 발생하게 된다. 즉 C++로 만들어진 클래스를 C#으로 한 번 더 감싸고 있다고 생각하자. 결국 GameObject.Destroy();를 통해 오브젝트를 파괴 한다는 것 은 UnityEngine.Object의 내부의 C++ NativeObjec..

Unity 2023.07.13

[프로그래머스]Lv.2 할인 행사 C#

https://school.programmers.co.kr/learn/courses/30/lessons/131127 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; public class Solution { public int solution(string[] want, int[] number, string[] discount) { int answer = 0; Dictionary dicWant = new Dictionary(); Dictionary dic = new..

※[프로그래머스]Lv.2 롤케이크 자르기C# (순차적으로 줄여나가기)

https://school.programmers.co.kr/learn/courses/30/lessons/132265 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; public class Solution { public int solution(int[] topping) { int answer = 0; Dictionary dicL = new Dictionary(); Dictionary dicR = new Dictionary(); foreach (int i in to..

※[프로그래머스]Lv.2 귤 고르기C# (Dictionary.TryAdd 중복 카운터)

https://school.programmers.co.kr/learn/courses/30/lessons/138476 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드1 using System; using System.Collections.Generic; using System.Linq; public class Solution { public int solution(int k, int[] tangerine) { int answer = 0; var distinct = tangerine.GroupBy(g => g).Select(s => s.Count())..

※[프로그래머스]Lv.2 숫자 변환하기 C# (Hashset)

https://school.programmers.co.kr/learn/courses/30/lessons/154538 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; public class Solution { public int solution(int x, int y, int n) { int answer = 0; List targets = new List { x }; List results = new List(); HashSet sames = new HashSet(..

※[프로그래머스]Lv.2 뒤에 있는 큰 수 찾기 C# (시간복잡도오류, 스택)

https://school.programmers.co.kr/learn/courses/30/lessons/154539 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 뒤에있는 숫자를 구할 때는 스택을 사용하는게 편리하다. using System; using System.Collections.Generic; using System.Linq; public class Solution { public int[] solution(int[] numbers) { int[] answer = new int[numbers.Length]; Array.Fill(answe..

[Unity] 미니맵 만드는 방법

카메라 생성 시점 조정 카메라 Projection을 Perspective에서 Orthographic으로 변경 Perspective와 Orthographic의 차이점은 원근법에 차이로 Perspective는 원근법이 적용되며 Orthographic는 원근법이 적용되지 않는다. Size 적용 원하는 Map Size에 맞게 size를 조정한다 Render Texture 생성 Assets폴더 안에 원하는 폴더하위 자식으로 Render Texture을 생성한다. ui - Raw Image생성 Raw Image와 Render Texture 연결 Raw Image의 texture에 만들었던 Render Texture를 연결한다. Camera와 Render Texture 연결 camera -> render textur..

Unity 2023.07.04

[프로그래머스]Lv.2 무인도 여행 C#(BFS)

https://school.programmers.co.kr/learn/courses/30/lessons/154540 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 소스코드 using System; using System.Collections.Generic; public class Solution { bool[,] found; public int[] solution(string[] maps) { found = new bool[maps.Length, maps[0].Length]; List answer = new List(); for (int i = 0; i ..

[Unity] 유용한 Asset

[Packetg Manager] Addressable 런타임시 에셋 자원 관리에 유용 프리펩 경로 등 자유자재로 변경해도 소스에 영향을 받지 않는다. https://gist.github.com/MeowKim/904087f7c2b372a5df72a0925add85d6 Unity Addressable Asset System 가이드 Unity Addressable Asset System 가이드. GitHub Gist: instantly share code, notes, and snippets. gist.github.com Memory Profiler 메모리 추적 https://docs.unity3d.com/kr/2021.2/Manual/ProfilerMemory.html 메모리 프로파일러 모듈 - Unity ..

Unity 2023.07.03