I'm experimenting with custom editors, and stumbled upon EditorGUILayout.Separator() while trying to figure out how to draw a line near the top of my inspector window, underneath a label field. It shows as valid in my IDE (no special libraries that I'm aware of), but for the life of me, I cannot figure out what, if anything, it's doing--because it definitely is not drawing a visible separator like I thought it might. It doesn't seem to take any arguments, and I cannot locate documentation for it (using Unity 2022.3.15f1, if that is of consequence).

I have the following code:

using UnityEngine;
using UnityEditor;

public class SomeDataEditor : Editor
    public override void OnInspectorGUI()
        SomeDataSO someData = (SomeDataSO)target;
        EditorGUILayout.LabelField(someData.name.ToUpper(), EditorStyles.boldLabel)
        EditorGUILayout.Space(20); // tried commenting this line out to see if .Separator()
                                   // introduced space to the editor window; not visible if so

1 Answer 1


In Visual Studio, we can control-click on an identifier such as a function name to jump to the definition for that identifier. In cases where the identifier definition comes from a compiled library, Visual Studio will attempt to decompile the library and show the source.

If we control-click on EditorGUILayout.Separator(), it shows us this function:

public static void Separator() {

In other words, Separator is just an alias for the version of EditorGUILayout.Space() with no arguments. It's probably better to use the Space() function, since it is documented.

  • \$\begingroup\$ If I may ask, what might be the purpose for having an alias for a function? Furthermore, what might be the purpose for having an alias for a function in this specific case? It doesn’t really make sense that EditorGUILayout.Space() would need to be called by some other name, does it? \$\endgroup\$
    – NJJ_002
    Commented May 1 at 12:52
  • 1
    \$\begingroup\$ Backwards compability for one example or if one function takes multiple parameter, you might have a second function that calls it with some fixed values \$\endgroup\$
    – Zibelas
    Commented May 1 at 13:27
  • 1
    \$\begingroup\$ @NJJ_002 I can think of two possible explanations: 1. They intended to eventually make the function do something different, and gave it this functionality as a placeholder, but forgot to finish it. 2. The function originally did something different in a much older version of Unity, but they removed that functionality and made it an alias for Space() so that code that references Separator() won't throw errors (in which case they should have added an [Obsolete] attribute to it, but maybe they forgot to do that). \$\endgroup\$
    – Kevin
    Commented May 1 at 17:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .