728x90
반응형

unity 64

[Unity]Get or set accessor expected 오류 원인 및 해결방법

Get or set accessor expected라는 오류를 발견한 사람들이 이 글을 본다는 가정하에 작성하겠습니다 아마 오류가 난 스크립트에서 빌드 도중 오류를 찍을 텐데 #if UNITY_EDITOR와 같이 한정된 곳에서만 실행되는 조건을 걸어두셨으리라 예상이 됩니다 그것은 위의 에러 코드와 연관이 있습니다 오류가 난 곳의 코드를 유심히 살펴 보면 #if UNITY_EDITOR if (somethind == true) { .... #endif } .... 위와 같은 실수를 발견하실 겁니다. #endif가 }전에 실행되기에 저 상황 이외에는 갑자기 }가 튀어나와 오류를 찍는 거죠 #if UNITY_EDITOR if (somethind == true) { .... } #endif .... 이처럼 원하는..

Unity 2020.09.11

[UNITY] Delegate / Event 를 생각하려 할 때 마다 까먹어서 적어두는 용

using UnityEngine; public class EventManager :MonoBehaviour { public static EventManager instance; public delegate void MyDelegate(); public event MyDelegate eventCall; void Awake() { instance = this; } public void EventCall() { eventCall(); } } using UnityEngine; public class Delegate_Sample : MonoBehaviour { void EventFunction() { Debug.Log("Success"); } public void OnButtonClick() { Debug.Log..

Unity 2020.09.01

[Unity] Playfab Function 정리 -2

랜덤 박스 실행 public bool RandomBoxGrant(string catalogversion, string tableId) //랜덤박스 { // First, roll a random number and evaluate the drop table PlayFabServerAPI.EvaluateRandomResultTable(new PlayFab.ServerModels.EvaluateRandomResultTableRequest() { CatalogVersion = catalogversion, TableId = tableId }, result => { Debug.Log("Success"); }, fail => { Debug.Log("Fail"); }); } 유저 타이틀 데이터 저장/가져오기 publi..

Unity 2020.08.18

[Unity] Playfab Function 정리 -1

커스텀 로그인 public void OnClickGuestLogin() { PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest() { //디바이스 아이디로 커스텀 로그인 CustomId = SystemInfo.deviceUniqueIdentifier, // 기존 계정이 없다면 생성 CreateAccount = true }, result => { Debug.Log("Success"); }, (error) => { Debug.Log("Fail"); }); } 인벤토리 업데이트 public void SetInventoryCustomData(string itemInstanceID, Dictionary datas) { PlayFab.ServerMode..

Unity 2020.08.18

[Unity] VR Hand Physics - Object collision

VR에선 컨트롤러 위치가 실제 컨트롤러의 움직임에 따라 출력됩니다. 따라서 모델을 컨트롤러 앵커 하위에 두게 되면 무슨 짓을해도 투과를 하더군요 그래서 꼼수를 부려봤습니다. 응용하셔서 재밌는 게임을 만들어주세요 여러분! 씬 구성은 이렇습니다. 물체 추돌 판정 스크립트(컨트롤러 앵커 하위의 CustomHandRight에 붙였습니다) using UnityEngine; using Node = UnityEngine.XR.XRNode; public class HandPositionController : MonoBehaviour { [HideInInspector] public Rigidbody handRig; public Node hand = Node.RightHand; public bool isStop; bool..

Unity 2020.03.12

[Unity] NavMesh - 자동으로 추격해오는 적 만들기 혹은 마우스로 장애물을 피해 캐릭터 움직이기

void Update(){ if (Input.GetMouseButton(0)) { Ray ray = cam.ScreenPointToRay(Input.GetMouseButton); RaycastHit hit; if(Physics.Raycast(ray, out hit)) { agent.SetDestination(hit.point); } } } 예제로 만든 씬의 구조입니다. window - ai - navigation을 눌러 navigation 패널을 열어줍니다 추적 해올 적을 위와 같이 세팅해줍니다. 그리고 지형지물을 전부 Static으로 만들어주거나 Navigation만 static으로 만들어 줍니다. 만약 문과 같이 이동해야하는 지형이 있다면 static으로 설정하시면 안됩니다. 그리고 아까 열어둔 Na..

Unity 2020.03.11
728x90
반응형