Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Hiding the parentheses (Class Type Name) from public property fields?

Discussion in 'Editor & General Support' started by sameng, Aug 6, 2023.

  1. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    172
    Hi, does anyone know how to hide the parentheses for (Class Type Name) from a public property field?
    Some built-in types don't have this, such as GameObject, Transform, Font, Material, Mesh, etc.

    But I cannot figure out how to get rid of it for my own types.

    See attached photo for a mockup of what I want: Screen Shot 2023-08-06 at 02.39.18.png
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,013
    Hmmm I'm not sure, just a hunch that perhaps a custom PropertyDrawer for the given type is needed to change the default name.

    But it may also be the responsibility of the list itself, so either that needs its own PropertyDrawer. If that does not work a custom Editor script with OnInspectorGUI that draws the list elements is the alternative.
     
  3. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    172
    I don't think it's the list itself since it does that for single property fields too.
    I was doing some digging and it seems every single ScriptableObject has the type name in parentheses.
    However almost zero built-in Unity types have the parentheses.

    For example,
    GameObject, Transform, Scene, Mesh, AudioClip, AvatarMask, LightingSettings, etc...

    I did find something maybe interesting... in ObjectListArea.cs I found a "AssetPreviewIgnoreList" with a public function to add to this list.
    Does anyone know anything about this? Where do I even access this? Or am I even barking up the wrong tree?
    Screen Shot 2023-08-06 at 14.40.26.png