Last active
February 22, 2019 12:22
-
-
Save tsubaki/51ef20b0f5ca7e2be9b4 to your computer and use it in GitHub Desktop.
UIのみを表示するシーンビュー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use