Does Unity have a "Nice Name" method?

Hi guys

If I write a script that looks like:

public class Test : MonoBehaviour
    public int someTestValue = 0;

    [SerializeField] private int m_SomeOtherTestValue = 1;

The inspector shows those fields like:

alt text

Does anyone know how this string manipulation is done? I’m sure I could bash something together with StringBuilder and some regex, but I’m wondering if the Unity API already has a method that takes a string and outputs a nice name.


The logic is contained in the ObjectNames class (documentation: Unity - Scripting API: ObjectNames)

Specifically, check out the NicefyVariableName method:

// Outputs the text: Some Variable Name
Debug.Log (ObjectNames.NicifyVariableName("someVariableName"));