장면 보기에 대한 사용자 정의 노트
1. 장면 보기의 크기 가져오기
// シーンビューのスクリーン幅を取得
var width = UnityEngine.Screen.width;
// シーンビューのスクリーン高さを取得
var height = UnityEngine.Screen.height;
2.'월드 좌표'를'화면 좌표'로 전환
// スクリーン座標を取得する
var screenPos = UnityEngine.RectTransformUtility.WorldToScreenPoint(worldCamera, worldPos);
3. 화면 좌표를 World 좌표로 변환
※ 필기를 반쯤 했어요.
UnityEngine.RectTransformUtility.ScreenPoint ToRay(world Camera, screenPos) 방법 사용
4. Hierrarchy에서 객체 삭제
장면 보기에서 작동하는 스크립트에
GameObject.DestroyImmediate 방법을 사용합니다.또한 일반적인 방법
GameObject.Destroy을 사용하면 다음과 같은 오류 메시지가 표시됩니다.Destroy may not be called from edit mode! Use DestroyImmediate instead.
Reference
이 문제에 관하여(장면 보기에 대한 사용자 정의 노트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/hikaru/articles/f9ef8c06a9c7240b5142텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)