|
|
- using UnityEngine;
- using UnityEditor;
-
- public class SceneViewCameraTest
- {
- [MenuItem("Tools/Move Scene To Camera #c")]
- static public void MoveSceneViewCamera()
- {
-
- if(Camera.main == null)
- {
- Debug.LogError("No Main camera in scene");
- return;
- }
-
- Vector3 position = Camera.main.transform.position;
- Quaternion rotation = Camera.main.transform.rotation;
-
- SceneView.lastActiveSceneView.size = 0.1f;
- SceneView.lastActiveSceneView.rotation = rotation;
- SceneView.lastActiveSceneView.pivot = position;
-
-
- SceneView.lastActiveSceneView.Repaint();
- }
- }
|