有无之境

Unity视图相机同步

主要用到APISceneView.lastActiveSceneView.camera

Game视图与Scene视图相机同步

Camera.main.transform.SetPositionAndRotation(SceneView.lastActiveSceneView.camera.transform.position, SceneView.lastActiveSceneView.camera.transform.rotation);

Scene视图与Game视图相机同步

Camera cameraMain = Camera.main;
var sceneView = SceneView.lastActiveSceneView;
if (sceneView != null)
{
    sceneView.cameraSettings.nearClip = cameraMain.nearClipPlane;
    sceneView.cameraSettings.fieldOfView = cameraMain.fieldOfView;
    sceneView.pivot = cameraMain.transform.position +
        cameraMain.transform.forward * sceneView.cameraDistance;
    sceneView.rotation = cameraMain.transform.rotation;
}

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »