카테고리 없음

unity AR plane detect 카메라 스크립트 예시

yonan 2020. 8. 31. 22:24

position visualizer

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PositionVisualizer : MonoBehaviour
{//카메라의 위치정보를 실시간으로 보여주는 스크립트
    private void OnGUI()
    {
        void Show(string text, TextAnchor align)
        {
            var rect = new Rect(0, 100, Screen.width, Screen.height*2/100);
            var style = new GUIStyle
            {
                alignment = align, fontSize=(int)rect.height,
                normal = {textColor= Color.red}
            };
            GUI.Label(rect, text, style);
        }
        Show($"{transform.position}",TextAnchor.UpperLeft); 
    }
}