- Home /
Place camera on scene with current view position and rotation.
Is it possible to place camera object in editor in the same position and rotation as my current scene view? I need to put lots of cameras on scene and changing each camera's position and rotation by hand after placing them on scene is a bit of pain.
Answer by roojerry · Jan 28, 2014 at 05:05 PM
Select your Camera in the Hierarchy,
and click:
GameObject->Align With View
from the menu bar.
This tip is so good, I sent a reward of 1,000 points :) .. Fattie
For anyone wondering, the shortcut is Ctrl + Shift + F. It says it next to the option in the GameObject menu mentioned above.
The BEST aspect of this tip is that it doesn't just work for Camera GameObjects, it works for ANY selected GameObject with a transform component. So - not just good for Camera align to view, but also for setting up spawn points/dummy transforms used as in-scene hierarchy roots for instantiated prefabs, etc.
Answer by FaffyWaffles · Mar 01 at 07:56 AM
using UnityEngine;
using UnityEditor;
[ExecuteInEditMode]
public class AlignCam : MonoBehaviour
{
public Camera gameCam;
public bool updateView = false;
private void LateUpdate()
{
if (updateView)
{
SceneView sceneCam = SceneView.lastActiveSceneView;
gameCam.transform.position = sceneCam.camera.transform.position;
gameCam.transform.rotation = sceneCam.camera.transform.rotation;
}
}
}