Last active
February 8, 2017 04:34
-
-
Save sokuhatiku/3a05f2e0f46441afc35697fa4e69277d to your computer and use it in GitHub Desktop.
Create AssetType Checker window
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 UnityEditor; | |
public class AssetTypeCheckerWindow : EditorWindow | |
{ | |
Object obj; | |
string msg; | |
[MenuItem("Window/AssetType Checker")] | |
static void Init() | |
{ | |
var window = GetWindow<AssetTypeCheckerWindow>(true, "AssetType Checker", true); | |
window.Show(); | |
} | |
public void OnGUI() | |
{ | |
EditorGUI.BeginDisabledGroup(true); | |
EditorGUILayout.ObjectField("Script", MonoScript.FromScriptableObject(this), typeof(MonoScript), false); | |
EditorGUI.EndDisabledGroup(); | |
var newobj = EditorGUILayout.ObjectField("Drop Here", obj, typeof(Object), true, GUILayout.Height(30f)); | |
if (newobj != obj) | |
{ | |
obj = newobj; | |
msg = newobj != null ? "Type = <b>" + newobj.GetType() + "</b>\nPath = " + AssetDatabase.GetAssetPath(newobj) + "" : ""; | |
} | |
var boxStyle = GUI.skin.GetStyle("HelpBox"); | |
boxStyle.richText = true; | |
boxStyle.fontSize = 12; | |
EditorGUILayout.TextArea(msg, boxStyle); | |
EditorGUILayout.Space(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment