Skip to content

Instantly share code, notes, and snippets.

@anchan828
Created June 10, 2012 03:04
Show Gist options
  • Save anchan828/2903701 to your computer and use it in GitHub Desktop.
Save anchan828/2903701 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
public class RenderGameViewCamerasScript : EditorWindow
{
[MenuItem("EditorGUIUtility/RenderGameViewCameras")]
static void OpenWindow ()
{
RenderGameViewCamerasScript window = GetWindow<RenderGameViewCamerasScript> ();
window.position = new Rect (50, 50, 500, 500);
}
private Rect rect1, rect2;
void OnGUI ()
{
rect1 = new Rect (0, 0, 300, 200);
//rect2は決め打ち。こうしないと描画がおかしくなる
rect2 = new Rect (0, 22, position.width, position.height);
EditorGUIUtility.RenderGameViewCameras (rect1, rect2, true, true);
this.Repaint ();
//強制的にGUI終了させないとNULLで怒られる。非推奨関数
EditorGUIUtility.ExitGUI ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment