public override void OnInspectorGUI() { base.OnInspectorGUI(); LccView lccView = (LccView)target; if (GUILayout.Button(lccView.className)) { string directoryName = string.Empty; switch (Path.GetFileNameWithoutExtension(lccView.type.GetType().Assembly.ManifestModule.Name)) { case "Unity.Model": directoryName = "Scripts"; break; case "Unity.Hotfix": directoryName = "Hotfix"; break; case "ILRuntime": directoryName = "Hotfix"; break; } string fileName = lccView.className; string[] filePaths = Directory.GetFiles($"Assets/{directoryName}", "*.cs", SearchOption.AllDirectories); foreach (string item in filePaths) { if (item.Substring(item.LastIndexOf(@"\") + 1) == $"{fileName}.cs") { EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath <TextAsset>(item)); AssetDatabase.OpenAsset(AssetDatabase.LoadAssetAtPath <Object>(item), 0); } } } ObjectTypeUtil.Draw(lccView.type, 0); }
public void Draw(Type memberType, string memberName, object value, object target, int indentLevel) { isFoldout = EditorGUILayout.Foldout(isFoldout, memberName, true); if (isFoldout) { EditorGUI.indentLevel = indentLevel; ObjectTypeUtil.Draw(value, indentLevel + 1); EditorGUI.indentLevel = indentLevel; } }