Created
March 29, 2020 13:26
-
-
Save sokuhatiku/06f6f9f5eab07541af4479a9e234e5ab to your computer and use it in GitHub Desktop.
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