UnityEditor.CubemapInspector.ObjectField C# (CSharp) Method

ObjectField() public static method

public static ObjectField ( string label, Object obj, Type objType, bool allowSceneObjects ) : Object
label string
obj Object
objType System.Type
allowSceneObjects bool
return Object
        public static Object ObjectField(string label, Object obj, Type objType, bool allowSceneObjects, params GUILayoutOption[] options)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUI.Label(GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 32f, EditorStyles.label, optionArray1), label, EditorStyles.label);
            GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(64f) };
            Object obj2 = EditorGUI.ObjectField(GUILayoutUtility.GetAspectRect(1f, EditorStyles.objectField, optionArray2), obj, objType, allowSceneObjects);
            GUILayout.EndHorizontal();
            return obj2;
        }

Usage Example

示例#1
0
        private void ShowFace(string label, CubemapFace face)
        {
            Cubemap cubemapRef = base.target as Cubemap;

            GUI.changed = false;
            Texture2D texture2D = (Texture2D)CubemapInspector.ObjectField(label, this.m_Images[(int)face], typeof(Texture2D), false, new GUILayoutOption[0]);

            if (GUI.changed)
            {
                TextureUtil.CopyTextureIntoCubemapFace(texture2D, cubemapRef, face);
                this.m_Images[(int)face] = texture2D;
            }
        }
All Usage Examples Of UnityEditor.CubemapInspector::ObjectField