Search Unity

Resolved Is there an Attribute to change script display name ?

Discussion in 'Scripting' started by Draad, May 2, 2023.

  1. Draad

    Draad

    Joined:
    Feb 17, 2011
    Posts:
    325
    Hey,

    I have few scripts with identical names into my hierarchy (from different namespaces). As they display with the same name in the AddComponent search tool, it's difficult to differentiate one from another.
    Screenshot 2023-05-02 at 11.08.30 AM.png

    Is it possible to change the name displayed here without changing script's file name OR to display the script hierarchy in the search tool ?
     
    Last edited: May 2, 2023
  2. Draad

    Draad

    Joined:
    Feb 17, 2011
    Posts:
    325
    Ok I found out the AddComponentMenu attribute that meet my needs.


    Code (CSharp):
    1. [AddComponentMenu("Any/Custom/Path/AnyCustomNameThatWillReplaceClassName")]
    2. public class Viewer : MonoBehaviour
    3. {
    4.  
    5. }