/// <summary> /// Override this method to make your own GUI for the property /// </summary> /// <param name="position">Position</param> /// <param name="prop">Property</param> /// <param name="label">Label</param> public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label) { label = EditorGUI.BeginProperty(position, label, prop); FindProperties(prop); // Draw the preview texture Rect textureRect = new Rect(position); textureRect.x += textureRect.width - PREVIEW_TEXTURE_SIZE; textureRect.width = PREVIEW_TEXTURE_SIZE; textureRect.height = PREVIEW_TEXTURE_SIZE; DrawPreviewTexture(textureRect); // Draw the fields Rect contentRect = new Rect(position); contentRect.width -= textureRect.width + HydraEditorUtils.STANDARD_HORIZONTAL_SPACING * 2.0f; HydraEditorUtils.Vector3Field(contentRect, s_NoiseFrequencyLabel, m_FrequencyProp); contentRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; HydraEditorUtils.Vector3Field(contentRect, s_NoisePhaseLabel, m_PhaseProp); EditorGUI.EndProperty(); }
/// <summary> /// Draws the content. /// </summary> /// <param name="position">Position.</param> /// <param name="locked">Locked.</param> protected override void DrawContent(Rect position, bool locked) { if (locked) { HydraEditorUtils.DrawUnindented( () => HydraEditorUtils.UniformVector3Field(position, GUIContent.none, m_VectorProperty)); return; } HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.Vector3Field(position, GUIContent.none, m_VectorProperty)); }