Skip to content

Instantly share code, notes, and snippets.

@sokuhatiku
Last active February 8, 2017 04:34
Show Gist options
  • Save sokuhatiku/3a05f2e0f46441afc35697fa4e69277d to your computer and use it in GitHub Desktop.
Save sokuhatiku/3a05f2e0f46441afc35697fa4e69277d to your computer and use it in GitHub Desktop.
Create AssetType Checker window
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