RendererFirstPersonFlagsDrawer.cs
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace VRM
{
[CustomPropertyDrawer(typeof(VRMFirstPerson.RendererFirstPersonFlags))]
public class RendererFirstPersonFlagsDrawer : PropertyDrawer
{
static Rect LeftSide(Rect position, float width)
{
return new Rect(position.x, position.y, position.width-width, position.height);
}
static Rect RightSide(Rect position, float width)
{
return new Rect(position.x + (position.width-width), position.y, width, position.height);
}
public override void OnGUI(Rect position,
SerializedProperty property, GUIContent label)
{
var rendererProp = property.FindPropertyRelative("Renderer");
var flagProp = property.FindPropertyRelative("FirstPersonFlag");
const float WIDTH = 140.0f;
EditorGUI.PropertyField(LeftSide(position, WIDTH), rendererProp, new GUIContent(""), true);
EditorGUI.PropertyField(RightSide(position, WIDTH), flagProp, new GUIContent(""), true);
}
/*
public override float GetPropertyHeight(SerializedProperty property,
GUIContent label)
{
return 60.0f;
}
*/
}
}