public FixedWidthLabel(GUIContent label) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(label, GUILayout.Width(GUI.skin.label.CalcSize(label).x + Helpers.IndentMultiplier * Mathf.Max(0, EditorGUI.indentLevel))); indentReset = new ZeroIndent(); }
private readonly ZeroIndent indentReset; //helper class to reset and restore indentation public FixedWidthLabel(GUIContent label)// constructor. {// state changes are applied here. EditorGUILayout.BeginHorizontal();// create a new horizontal group EditorGUILayout.LabelField(label, GUILayout.Width(GUI.skin.label.CalcSize(label).x + 10 +// actual label width 10 * EditorGUI.indentLevel));//indentation from the left side. It's 9 pixels per indent level indentReset = new ZeroIndent();//helper class to have no indentation after the label }
private readonly ZeroIndent indentReset; //helper class to reset and restore indentation public FixedWidthLabel(GUIContent label) // constructor. { // state changes are applied here. EditorGUILayout.BeginHorizontal(); // create a new horizontal group EditorGUILayout.LabelField(label, GUILayout.Width(GUI.skin.label.CalcSize(label).x + // actual label width 9 * EditorGUI.indentLevel)); //indentation from the left side. It's 9 pixels per indent level indentReset = new ZeroIndent(); //helper class to have no indentation after the label }
private readonly ZeroIndent _indentReset; // Helper class to reset and restore indentation public FixedWidthLabel(GUIContent label) { float indentation = IndentationWidth * EditorGUI.indentLevel; EditorGUILayout.BeginHorizontal(); GUILayout.Space(indentation); float width = Mathf.Max(EditorGUIUtility.labelWidth - indentation, GUI.skin.label.CalcSize(label).x); GUILayout.Label(label, GUILayout.Width(width)); _indentReset = new ZeroIndent(); }
public FixedWidthLabel(GUIContent label) { //Create a horizontal group EditorGUILayout.BeginHorizontal(); //Display the label: EditorGUILayout.LabelField(label, //Fix its width: GUILayout.Width(GUI.skin.label.CalcSize(label).x + //Correct for previous indentation: (9 pixels per level) 9 * EditorGUI.indentLevel)); //Set following indentation to zero: indentReset = new ZeroIndent(); }
private readonly ZeroIndent _indentReset; // Helper class to reset and restore indentation public FixedWidthLabel(GUIContent label) { #if PRE_UNITY_4_3 float indentation = kIndentationWidth * EditorGUI.indentLevel + kLeftPaddingWidth; #else float indentation = kIndentationWidth * EditorGUI.indentLevel; #endif EditorGUILayout.BeginHorizontal(); GUILayout.Space(indentation); float width = Mathf.Max(EditorGUIUtilityInternal.labelWidth - indentation, GUI.skin.label.CalcSize(label).x); GUILayout.Label(label, GUILayout.Width(width)); _indentReset = new ZeroIndent(); }