1. 程式人生 > >Unity學習筆記

Unity學習筆記

記錄學習過程中一些零散的Unity知識點

1 . 螢幕座標轉世界座標

Vector3 screenPos = new Vector3(Screen.width,0,0);
Vector3 moveWidth = Camera.main.ScreenToWorldPoint(screenPos);

2 . 獲取物體尺寸

GetComponent<Renderer>().bounds.extents;