Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEditor;
- [ExecuteInEditMode,InitializeOnLoad]
- public class CopySceneView : MonoBehaviour {
- void Start () {
- EditorApplication.update -= Update;
- EditorApplication.update += Update;
- }
- public Camera sceneCamera = null;
- void Update () {
- if( sceneCamera == null && SceneView.lastActiveSceneView != null && SceneView.lastActiveSceneView.camera != null ){
- sceneCamera = SceneView.lastActiveSceneView.camera;
- }
- if(sceneCamera!=null){
- transform.position = sceneCamera.transform.position;
- transform.rotation = sceneCamera.transform.rotation;
- }
- }
- void OnDisable() {
- EditorApplication.update -= Update;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement