16 public static bool Button(
string text, params GUILayoutOption[] options)
18 return Button(text, GUI.skin.button, options);
21 public static bool Button(
string text, GUIStyle style, params GUILayoutOption[] options)
23 EditorGUILayout.BeginHorizontal();
25 bool pressed = GUILayout.Button(text, style, options);
26 EditorGUILayout.EndHorizontal();
30 public static void Label(
string text, params GUILayoutOption[] options)
32 Label(text, EditorStyles.label, options);
35 public static void Label(
string text, GUIStyle style, params GUILayoutOption[] options)
37 EditorGUILayout.BeginHorizontal();
39 GUILayout.Label(text, style, options);
40 EditorGUILayout.EndHorizontal();
43 public static T ObjectField<T>(GUIContent guiContent, T value,
bool allowSceneObjects =
false, GUILayoutOption[] guiLayoutOptions = null)
45 object objValue = value;
53 Type valueType = objValue.GetType();
54 if (valueType == typeof(Material))
56 objValue = EditorGUILayout.ObjectField(guiContent, (Material)objValue, typeof(Material), allowSceneObjects, guiLayoutOptions);
58 else if (valueType == typeof(SceneAsset))
60 objValue = EditorGUILayout.ObjectField(guiContent, (SceneAsset)objValue, typeof(SceneAsset), allowSceneObjects, guiLayoutOptions);
64 objValue = EditorGUILayout.ObjectField(guiContent, (
UnityEngine.Object)objValue, valueType, allowSceneObjects, guiLayoutOptions);
68 throw new ArgumentException(
70 CultureInfo.InvariantCulture,
71 "Unimplemented value type: {0}.",
UnityEngine.UI.Button Button