IsPointerOverGameObject 가 동작하나요? #1167
Andwhy81kr
announced in
5. Q&A
Replies: 1 comment
-
안녕하세요, 저희 쪽에서 확인 결과 Unity 자체 이슈로 InputSystemUIInputModule 컴포넌트를 사용할 때, 제페토 프로젝트에서는 호환성을 위해 컨텐츠 씬에서 UI Component Input에 대해, 그래서 직접 raycast 통해 UI 에 대한 Input Event를 처리하는 방식으로 직접 핸들링이 가능합니다. 아래 예제 코드를 참고하여 주세요. import { ZepetoScriptBehaviour } from 'ZEPETO.Script'
import { Input, Physics, RaycastHit, Vector2 } from "UnityEngine";
import {EventSystem, PointerEventData, RaycastResult } from 'UnityEngine.EventSystems';
import { List$1 } from 'System.Collections.Generic';
export default class IPointerTest extends ZepetoScriptBehaviour {
public static IsPointerOverUIObject(position : UnityEngine.Vector2)
{
let vector2 : UnityEngine.Vector2 = position;
let eventData : PointerEventData = new PointerEventData(EventSystem.current);
eventData.position = position;
let rayCastResults = new List$1<RaycastResult>();
EventSystem.current.RaycastAll(eventData, rayCastResults);
return rayCastResults.Count > 0;
}
Update(){
if (Input.touches.length > 0
&& IPointerTest.IsPointerOverUIObject(Input.GetTouch(0).position)) {
// UI touch Check
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
안녕하세요.
제페토에서
EventSystem.current.IsPointerOverGameObject(Input.touches[0].fingerId)
이함수가 정상작동 하는지 알고 싶습니다.
에디터상에서 마우스를 이용한 IsPointerOverGameObject는 정상작동 하는게 확인이 되는데, 모바일에서 테스트 할땐 작동이 안되고 있는것 같습니다.
확인 부탁합니다.
Beta Was this translation helpful? Give feedback.
All reactions