Babybus-u3d技术交流-对齐场景中的摄像机
using UnityEngine;
using System.Collections;
using UnityEditor;
public class CameraContextMenu
{
[MenuItem("CONTEXT/Camera/Align With View")]
static void AlignWithView(MenuCommand menuCommand)
{
Undo.RecordObject(menuCommand.context, "AlignWithView");
var camera = menuCommand.context as Camera;
var sceneViewCamera = SceneView.currentDrawingSceneView.camera;
camera.transform.position = sceneViewCamera.transform.position;
camera.transform.rotation = sceneViewCamera.transform.rotation;
camera.isOrthoGraphic = sceneViewCamera.isOrthoGraphic;
camera.fieldOfView = sceneViewCamera.fieldOfView;
}
}