[Unity error] instantiate함수 사용해도 게임뷰에 안보일 때
instantiate함수 사용해도 게임뷰에 안보일 때 1. 프리팹의 SetActive를 활성화 시켜주지 않았을 때 instantiate함수를 사용해서 오브젝트를 생성해도 생성된 객체가 보이지 않는다. 2. instantiate는 되었는데, 보이지 않는 위치에 있을수도 있다. 3. 당연하지만, 잘못짠 코드로 인해 instantiate가 수행되지 않았을 수 있다.
2021.04.06
[Unity error] Debug 창을 사용할 수 없는 경우
Debug 창을 사용할 수 없는 경우 AR개발을 하면서 직면하고 있는 상황이다. Debug창을 사용할 수 없다면 화면에 Text를 띄우는 형식으로 디버깅을 할 수 있을 것이다. 그런데 이런 Text마저 안뜬다면 로직이 잘못됐을 가능성이 크다. if (placementPoseIsValid && Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { farmerScript.FarmerInstantiate(); GameObject.Find("UI").transform.FindChild("DebugText").gameObject.SetActive(true); PlaceObject(); } 위와 같은 코드 상황일 때 farmerScript.F..
2021.04.05
no image
[Unity] 비활성화 된 GameObject찾기
문제점 GameObject가 비활성화 상태였는데. Find함수로 찾으려니 안찾아졌다. 해결방법 비활성화 된 객체를 활성화시키려면, 활성화된 부모를 찾아서 자식을 찾는 형식으로 접근해야 합니다. 참고로, 비활성화 된 게임오브젝트에 부모가 없는 경우라면 활성화된 빈 오브젝트를 만들고 비활성화된 오브젝트를 빈 오브젝트의 자식으로 만들면 문제를 해결할 수 있습니다. (당연한 말이지만, 스크립트 컴포넌트가 활성화되어 있는 곳에서 호출해야 한다. 즉, Cube 게임오브젝트에 스크립트 컴포넌트를 넣어놓고 Cube를 SetActive를 통해 비활성화시킨뒤, 다시 켜도록하면 당연히 켜지지 않는다. Cube게임오브젝트의 스크립트 컴포넌트까지 같이 꺼져버리기 때문.) 씬에는 Plane, CubeParent그리고 CubePa..
2021.04.05
[Unity, C#] 스크립트 작성 규칙 / naming convention
Why do C# developers newline opening brackets? I've spent most of the last several years working mainly with C# and SQL. Every programmer I've worked with over that time was in the habit of placing the opening brace of a function or control flow softwareengineering.stackexchange.com C# 개발자들의 중괄호 style에 관한 글입니다. 재밌으니 읽어보시는 것도.. 위 링크의 글에 따르면 예전 C가 개발되었을 때 컴퓨터 디스플레이의 상태는 지금의 디스플레이보다 작은 상태이기에, 수직 공간..
2021.03.31
[Unity] Mathf.Lefp / 유니티 Lerp에 대하여
Lerp함수에 대하여 [Unity] 유니티 3D Vector의 선형보간 Lerp 정확한 사용법 [Unity] 유니티 3D Vector의 선형보간 Lerp 오늘은 유니티에서 굉장히 많이 이용되는 선형 보간 함수를 소개하겠습니다, 우선 선형보간이란 이런 것입니다. 선형 보간법 위키백과, 우리 모두의 백과 iygames.tistory.com [C#] Mathf.Lerp 쉽게 이해하기 유니티에서 Lerp는 대부분 선형 보간을 사용하여 부드러운 움직임을 표현하기 위해 Update에 넣어 사용하... blog.naver.com 위 링크의 블로그를 보면 Lerp(선형보간)에 대해 자세한 설명이 적혀있습니다. 위 블로그링크에서는 Vector3.Lerp()함수를 기준으로 설명하고 있습니다. 선형보간이란 a, b값이 주어..
2021.03.24
[Unity] Object.Instantiate 함수 (자동 world space좌표로 변환)
Unity - Scripting API: Object.Instantiate This function makes a copy of an object in a similar way to the Duplicate command in the editor. If you are cloning a GameObject you can specify its position and rotation (these default to the original GameObject's position and rotation otherwise). If you docs.unity3d.com wergia.tistory.com/213 위 링크에서 스크린 좌표와 월드 좌표에 관한 설명을 보던 중 마우스 위치 좌표가 월드 공간의 좌표로 변환된다..
2021.03.21
no image
[Unity] VsCode로 연동 시 intellisense 작동안함.
서론 Intellisense란? 매개 변수 정보나 필드 정보, 함수 정보등을 보여주는 것이 intellisense의 역할이다. 문제점 나는 VS code의 Go to Definition이 안되는 문제였는데, 이 기능을 지원해주려면 intellisense기능이 제대로 동작되어야 한다. 해결법 1. 우선 아래 링크를 기준으로 VScode에서 Unity를 사용할 수 있는 세팅을 한다. VS Code를 사용해서 Unity 개발하기 (mac 세팅 포함) VS Code를 사용해서 Unity 개발하기 (mac 세팅 포함) 유니티의 경우 안드로이드 스튜디오(안드로이드 개발 시 사용)와 XCode(os x, ios 앱 개발 시 사용)와 달리 게임 구성 편집 밀 빌드를 담당하는 '유니 jungpaeng.tistory.co..
2021.03.08
no image
[Unity] SetActive와 enabled
Unity - Scripting API: GameObject.SetActive A GameObject may be inactive because a parent is not active. In that case, calling SetActive will not activate it, but only set the local state of the GameObject, which you can check using GameObject.activeSelf. Unity can then use this state when all paren docs.unity3d.com Unity - Scripting API: Behaviour.enabled Success! Thank you for helping us impro..
2021.03.05
no image
[Unity] RequireComponent란?
Unity - Scripting API: RequireComponent When you add a script which uses RequireComponent to a GameObject, the required component will automatically be added to the GameObject. This is useful to avoid setup errors. For example a script might require that a Rigidbody is always added to the same G docs.unity3d.com RequireComponent RequireComponent속성은 요구되는 컴포넌트를 종속성으로 자동으로 추가해줍니다. RequireComponent를..
2021.03.05