본문 바로가기

개발/Unity

[Unity] 스크립트 통해 Scene View 카메라 조작

커스텀 에디터를 만들다 보면

특정 조건에서 씬뷰의 카메라를 내가 원하는 위치와 각도로 제한하고 싶은 경우가 있는데

아래와 같은 코드를 통해 씬뷰의 카메라를 제어 할 수 있다.

 

using UnityEditor;

var sceneView = SceneView.lastActiveSceneView;
sceneView.rotation = Quaternion.Euler(new Vector3(90, 0, 0));
sceneView.pivot = Vector3.zero;
sceneView.size = 50;
sceneView.orthographic = true;

 


forum.unity.com/threads/moving-scene-view-camera-from-editor-script.64920/

 

Moving scene view camera from editor script--

There are 7 pages of threads somewhat related to this, and I've gone through most of them. Most of them say to grab 'Camera.current' and use that--...

forum.unity.com

 

'개발 > Unity' 카테고리의 다른 글

[Unity] newtonsoft Json.NET  (0) 2020.09.17
[Unity] SQLite 사용 샘플 코드  (0) 2020.07.23
[C#] .cs to .dll  (0) 2020.07.23
[Unity] 유용한 애셋  (0) 2020.07.21
[Unity] UGUI Input에서 Done 버튼 처리  (0) 2019.12.03