@@ -29,20 +29,20 @@ public static float Indent
2929
3030 public static bool Button ( Rect position , string text )
3131 {
32- return EditorGUIExtensions . Button ( position , new GUIContent ( text ) ) ;
32+ return Button ( position , new GUIContent ( text ) ) ;
3333 }
3434
3535 public static bool Button ( Rect position , GUIContent content )
3636 {
37- float indent = EditorGUIExtensions . Indent ;
37+ float indent = Indent ;
3838 position . x += indent ;
3939 position . width -= indent ;
4040 return GUI . Button ( position , content ) ;
4141 }
4242
4343 public static void Label ( Rect position , string text )
4444 {
45- float indent = EditorGUIExtensions . Indent ;
45+ float indent = Indent ;
4646 position . x += indent ;
4747 position . width -= indent ;
4848 GUI . Label ( position , text ) ;
@@ -52,21 +52,19 @@ public static void Label(Rect position, string text)
5252 // Doesn't handle serialized types with nested serialized children.
5353 public static float GetTypeHeight ( bool hasLabel , Type valueType )
5454 {
55- if ( valueType == typeof ( Vector3 ) ||
56- valueType == typeof ( Vector2 ) )
55+ if ( valueType == typeof ( Vector3 ) || valueType == typeof ( Vector2 ) )
5756 {
58- return ( ! hasLabel || EditorGUIUtility . wideMode ? 0f : EditorGUIUtility . singleLineHeight ) +
59- EditorGUIUtility . singleLineHeight ;
57+ return ( ! hasLabel || EditorGUIUtility . wideMode ? 0f : EditorGUIUtility . singleLineHeight ) + EditorGUIUtility . singleLineHeight ;
6058 }
61- else if ( valueType == typeof ( Rect ) )
59+
60+ if ( valueType == typeof ( Rect ) )
6261 {
63- return ( ! hasLabel || EditorGUIUtility . wideMode ? 0f : EditorGUIUtility . singleLineHeight ) +
64- EditorGUIUtility . singleLineHeight * 2 ;
62+ return ( ! hasLabel || EditorGUIUtility . wideMode ? 0f : EditorGUIUtility . singleLineHeight ) + EditorGUIUtility . singleLineHeight * 2 ;
6563 }
66- else if ( valueType == typeof ( Bounds ) )
64+
65+ if ( valueType == typeof ( Bounds ) )
6766 {
68- return ( ! hasLabel ? 0f : EditorGUIUtility . singleLineHeight ) +
69- EditorGUIUtility . singleLineHeight * 2 ;
67+ return ( ! hasLabel ? 0f : EditorGUIUtility . singleLineHeight ) + EditorGUIUtility . singleLineHeight * 2 ;
7068 }
7169
7270 return EditorGUIUtility . singleLineHeight ;
@@ -83,7 +81,7 @@ public static float GetTypeHeight(bool hasLabel, Type valueType)
8381 /// <returns>The new value.</returns>
8482 public static T ObjectField < T > ( Rect position , GUIContent label , T value , bool allowSceneObjects )
8583 {
86- object objValue = ( object ) value ;
84+ object objValue = value ;
8785
8886 Type valueType = objValue . GetType ( ) ;
8987 if ( valueType == typeof ( Bounds ) )
@@ -94,6 +92,10 @@ public static T ObjectField<T>(Rect position, GUIContent label, T value, bool al
9492 {
9593 objValue = EditorGUI . ColorField ( position , label , ( Color ) objValue ) ;
9694 }
95+ else if ( valueType == typeof ( Material ) )
96+ {
97+ objValue = EditorGUI . ObjectField ( position , ( Material ) objValue , typeof ( Material ) , allowSceneObjects ) ;
98+ }
9799 else if ( valueType == typeof ( AnimationCurve ) )
98100 {
99101 objValue = EditorGUI . CurveField ( position , label , ( AnimationCurve ) objValue ) ;
@@ -151,6 +153,10 @@ public static T ObjectField<T>(Rect position, GUIContent label, T value, bool al
151153
152154 objValue = EditorGUI . Vector4Field ( position , label . text , ( Vector4 ) objValue ) ;
153155 }
156+ else if ( Equals ( objValue , typeof ( SceneAsset ) ) )
157+ {
158+ objValue = EditorGUI . ObjectField ( position , ( SceneAsset ) objValue , typeof ( SceneAsset ) , allowSceneObjects ) ;
159+ }
154160 else if ( objValue is UnityEngine . Object )
155161 {
156162 objValue = EditorGUI . ObjectField ( position , label , ( UnityEngine . Object ) objValue , valueType , allowSceneObjects ) ;
0 commit comments