🚩개요
회사 프로젝트에서 특정 씬을 갔다오면
Input.GetMouseButtonDown()
Input.GetMouseButton()
Input.GetMouseButtonUp()
3총사가 안먹혔다.
찾고보니 골때리는 해결법이라서 기록해둔다.
🔥본문
결론부터 말하자면 원인은 LeanTouch라는 에셋이었다.
이 에셋의 LeanTouch 컴포넌트를 보면
Disable Mouse Emulation
이라는 bool
변수가 있다.
이 변수가 어떤짓을 해버리냐면...
바로 Input.simulateMouseWithTouches
를 false
로 만들어버린다...!!
저게 false
가 돼버리면 터치 입력을 마우스 입력으로 받아들이질 않는다. (기본값은 당연히 true
)
심지어 LeanTouch
는 기본값으로 Input.simulateMouseWithTouches
를 false
로 만들어버리기 때문에
그냥 씬에 갔다 놓기만해도 마우스 입력 변환이 계속 꺼져버리는 것
DisableMouseEmulation
옵션을 꺼서 해결을 봤다.
🧠 마치며
에셋에서 이런 중요한걸 기본값으로 건드려버릴줄은 상상도 못했다.
애초에 사실 Input.simulateMouseWithTouches
라는 옵션이 있는줄도 몰랐다.
Unity를 오래 사용해왔지만 아직도 모르는게 많다는게 신기하기도 하다.
이제부턴 에셋을 사용함에있어서 좀더 신중하게 결정을 해야겠다.
🔗참조
https://docs.unity3d.com/ScriptReference/Input-simulateMouseWithTouches.html
Unity - Scripting API: Input.simulateMouseWithTouches
Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close
docs.unity3d.com
'Unity > TroubleShooting' 카테고리의 다른 글
[Unity] Addressable로 불러온 모델이 에디터에서 핑크(마젠타) 쉐이더로 나올때 (0) | 2024.05.12 |
---|---|
[Unity] HDR옵션을 켜면 RenderTexture의 배경이 보이는 문제 (1) | 2024.01.09 |
[Unity] Admob사용 시 Screen.Orientation을 건드리면 생기는 문제 (0) | 2023.05.31 |
[Firebase] FirebaseAuth 소셜로그인 콜백 주의점 (0) | 2023.05.26 |
[Unity] TCP통신에서 패킷이 누락되는듯한 문제 수정 (0) | 2022.10.18 |