protected virtual Rect DisplayContent(int index, Rect rect, float rightMargin) { Rect r = new Rect(rect); r.width -= rightMargin; r.height -= _space; GUIStyle style = new GUIStyle("Box"); style.normal.background = ExtTexture.MakeTex(600, 1, Color.red); GUI.Box(r, "", style); rect.position = new Vector2(rect.position.x + rect.width - rightMargin + _space, rect.position.y); rect.width = rightMargin; return(rect); }
private void DrawWaypointEditor(Rect rect, int index) { float colorFieldSize = rect.width / 30; Rect r = rect; r.width -= colorFieldSize; SerializedProperty element = _controllers.serializedProperty.GetArrayElementAtIndex(index); if (element == null || element.objectReferenceValue == null) { EditorGUI.PropertyField(r, element); return; } //description & field PointsOnSplineExtension pointOnSpline = (PointsOnSplineExtension)element.objectReferenceValue; bool isActiveInHierarchy = pointOnSpline.gameObject.activeInHierarchy; SerializedProperty description = new SerializedObject(element.objectReferenceValue).FindProperty("_description"); EditorGUI.BeginDisabledGroup(!isActiveInHierarchy); { EditorGUI.PropertyField(r, element, new GUIContent(description.stringValue, "Point On Splines")); } EditorGUI.EndDisabledGroup(); //box GUIStyle style = new GUIStyle("Box"); SerializedProperty color = new SerializedObject(element.objectReferenceValue).FindProperty("_colorWayPoints"); style.normal.background = ExtTexture.MakeTex(600, 1, color.colorValue); r.position = new Vector2(rect.width - colorFieldSize + 45, r.position.y); r.width = colorFieldSize - 2; GUI.Box(r, "", style); }