Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active February 22, 2019 12:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/51ef20b0f5ca7e2be9b4 to your computer and use it in GitHub Desktop.
Save tsubaki/51ef20b0f5ca7e2be9b4 to your computer and use it in GitHub Desktop.
UIのみを表示するシーンビュー
using UnityEngine;
using System.Collections;
using UnityEditor;
public class UISceneView : SceneView{
[MenuItem("Window/UISceneView")]
static void Init()
{
var window = ScriptableObject.CreateInstance<UISceneView> ();
window.in2DMode = true;
window.m_SceneLighting = false;
window.Show ();
}
int glovalLayer;
void OnFocus() {
glovalLayer = Tools.visibleLayers;
}
void OnLostFocus() {
Tools.visibleLayers = glovalLayer;
}
void OnGUI()
{
var layers = Tools.visibleLayers;
Tools.visibleLayers = 32;
var type = typeof(SceneView);
var methodOnGUI = type.GetMethod ("OnGUI",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
methodOnGUI.Invoke (this, null);
Tools.visibleLayers = layers;
}
}
@tsubaki
Copy link
Author

tsubaki commented Jan 6, 2016

http://cdn-ak.f.st-hatena.com/images/fotolife/t/tsubaki_t1/20150921/20150921223212.png

how to use

  1. create a "Editor" folder in /Assets/ folder.
  2. put UISceneView.cs in Editor folder
    screen shot 2016-01-06 at 11 48 41
  3. select window/ui scene view
    screen shot 2016-01-06 at 11 45 29
  4. Hide UI layer
    screen shot 2016-01-06 at 11 46 49
  5. disable skybox in ui scene view
    screen shot 2016-01-06 at 11 50 53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment