SamsonGame/Assets/Sources/Feel/MMTools/Editor/MMAttributes/MMMonoBehaviourDrawerHelper.cs

28 lines
757 B
C#
Raw Permalink Normal View History

2021-12-29 20:50:11 +03:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace MoreMountains.Tools
{
[InitializeOnLoad]
public static class MMMonoBehaviourDrawerHelper
{
public static void DrawButton(this Editor editor, MethodInfo methodInfo)
{
if (GUILayout.Button(methodInfo.Name))
{
methodInfo.Invoke(editor.target, null);
}
}
public static void DrawVerticalLayout(this Editor editor, Action action, GUIStyle style)
{
EditorGUILayout.BeginVertical(style);
action();
EditorGUILayout.EndVertical();
}
}
}