Skip to content

Instantly share code, notes, and snippets.

@ousttrue
Created March 12, 2016 19:53
Show Gist options
  • Save ousttrue/754c00933cf3ba22a348 to your computer and use it in GitHub Desktop.
Save ousttrue/754c00933cf3ba22a348 to your computer and use it in GitHub Desktop.
Unity
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class EditorCamera : MonoBehaviour {
// Update is called once per frame
void OnRenderObject () {
#if UNITY_EDITOR
if (SceneView.lastActiveSceneView == null) return;
var camera = SceneView.lastActiveSceneView.camera;
transform.position=camera.transform.position;
transform.rotation = camera.transform.rotation;
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment