Changing script name displayed in inspector


I have multiple instances of a script on my game object and would like to change their displayed mono behaviour type displayed name for the component in the inspector. Can it be done via my custom editor for this component, and how ?

This is an old question however for my purposes you can set [AddComponentMenu(“name as string”)]

This will set the display name of the component and can put the component under a given menu; handy if you are a content/asset developer for example

[AddComponentMenu("myName/myProduct/v1/dohicky (v1)")]


[AddComponentMenu("myName/myProduct/v2/dohicky (v2)")]

This will cause the Add Component button in the inspector to show a folder structure also if they search for dohicky they will see dohicky (v1) and dohicky (v2) even if the scripts them selves have the same name. Again probably not what the OP was looking for but the question has come up several times RE set or change component display name so thought it might help others.

You want to change the script name? If so then you will need separate scripts and then you can rename each in the editor to whatever you need.

In a script you can make a copy of the script useing AddComponent and then store it in a var. That way you can access that script useing that var. You should put this in the function Awake so that it’s only creates a copy for the first one.