예제 #1
0
        static object MaterialPropertyDrawer(Rect r, object prop)
        {
            if (!(prop is MaterialProperty matProp))
            {
                return(null);
            }

            switch (matProp.type)
            {
            case MaterialProperty.PropType.Color:
                return(MaterialEditor.ColorPropertyInternal(r, matProp, GUIContent.none));

            case MaterialProperty.PropType.Float:
                return(MaterialEditor.FloatPropertyInternal(r, matProp, GUIContent.none));

            case MaterialProperty.PropType.Range:
                return(MaterialEditor.RangePropertyInternal(r, matProp, GUIContent.none));

            case MaterialProperty.PropType.Vector:
                return(MaterialEditor.VectorPropertyInternal(r, matProp, string.Empty));

            case MaterialProperty.PropType.Texture:
                return(EditorGUI.DoObjectField(r, r, GUIUtility.GetControlID(FocusType.Passive), matProp.textureValue, matProp.targets[0], typeof(Texture), null, true, null));
            }

            return(null);
        }