Component Names - Press F2 to Rename

—— Asset Store ——

Ever had trouble distinguishing multiple colliders on the same GameObject from each other?

Ever wished you could rename that generic “Event Trigger” component to something a little more descriptive like “On Click Open Settings”?

What if you could attach little notes to your components to provide some clarifying context?

Wouldn’t it be great if you could see the current state of that “Health” component right in the title without having to unfold it?

Now you can!

Component Names integrates seamlessly with the Inspector and makes it possible to rename components at will as if it was a native feature.

7882738--1003498--renaming-components.gif

Features

  • Select a component’s header and press F2 to start renaming it (or select “Rename” from the context menu if your keyboard is broken).
  • Default name is shown in parentheses after the custom name automatically by default.
  • Custom component names can be seen inside Object fields.
  • All custom name data is fully stripped from builds.

Additional Features For Coders

  • Acquire custom component names in code via Component.GetName extension method (great for debugging!).
  • Link component name to its current state by using Component.SetName extension method in OnValidate.
  • Make Component.name and Component.ToString return custom component names by deriving from custom base class.

Compatibility

  • Compatible with Power Inspector, Odin Inspector and all your other custom editors.
5 Likes

Oh man, this has been on my “please add this to unity” wish list since the 4.x days.

Any chance this feature will get added to PowerInspector? I’m looking the features over there, and I think I’d want to go all in with PowerInspector on my project, but I’d hate to miss out on this feature.

@BetaMark Ouch, that’s a pretty lengthy wait!

I’ve been mulling over this functionality since 2019 (after I stumbled upon [this thread]( Please add a renamer feature to components! page-2)). I’ve tried out a couple of different approaches to solving this over the years, but never was able to put together anything up to a standard I was satisfied with - until I finally had a Eureka moment more recently and this is the end result :slight_smile:

I don’t have any plans to add built-in component renaming functionality to Power Inspector, however Component Names is fully compatible with Power Inspector as well.

If I change Inspector to Debug mode, and change the script of a component with its extended class which has different name. Then the header name could not refresh correctly.

If I press F2 and delete all string and press enter to clear the name, the old name are still there.
and the string in the rename input editor will become “Melee1 <color=grey>(Melee Weapon)” next time. In this specific case, the real name of new script is “PP Melee Weapon”

I think we should have a “Clear all meta data of Component Names” option in the context menu.

Hey @JustusPan thanks for letting me know about this. I’ll investigate how to fix these issues that happen if an attached component’s type is swapped to a different in debug mode.

All existing component name meta data should get cleared when you give a component a blank name, just like you tried, but in this case things don’t seem to be working as they should after the type change. If it’s possible, removing the component, and re-adding it should cause all the corrupted metadata to get cleared. But I’ll investigate on my side how to resolve situations like this automatically.

1 Like

You can now nab Component Names alongside 28 other assets as part of the [Power Up Tools Mega Bundle!

8523182--1136825--power-up-tools-mega-bundle.gif](https://assetstore.unity.com/mega-bundles/power-up-tools)

Hello:

In current Unity 2021.3 LTS, the component name is not showing in the inspector until it is not changed for the second time.

Also, after uninstalling the asset, a hidden object remains in the hierarchy (NameContainer).

Regards.

Hey @trueh !

I’ll check the asset in Unity 2021.3 and starting working on a fix. Thanks for letting me know!

If you want to remove Component Names from a project you can use the uninstall tool I’ve attached below to clean up your scenes from any leftover empty name containers.

8544584–1141943–component-names-uninstaller.unitypackage (2.44 KB)

Thank you @SisusCo !

@trueh I managed to track down what was causing the issue and have now a fix for it. I’ll submit the fix to the asset store for review today, and it’ll probably become available for download early next week.

If you’d like to get your hands on the fixed version before that just drop me a PM and I can send it your way.

@Thank you @SisusCo . Don’t worry, I will wait for the update in the Asset Store :slight_smile:

1 Like

Hey, @SisusCo really liking the plugin so far. I was wondering though, would it be at all possible to have the custom names also show up when the component is being referenced as a parameter in a UnityEvent ?

Example:

The method being called in this instance is

public void PrintComponentName(NamedComponent component)
{
    Debug.Log(component.GetName());
}

Hey @GoldenJude , glad to hear you’re enjoying plugin :slight_smile:

Ah right, I had not realized that element is not currently covered. I’ll investigate if I can make it reflect the custom name as well.

Thanks for the feedback!

HI, it seems that when I select multiple, and it is the same type or script the component renames is not properly renamed
Multiple

Single

@SisusCo

Hi @XBLANKZ Thanks for letting me know about the shortcoming!
I’ll try to get multi-editing working properly for the next version.

Bug Report: Deleted component in prefab variant could not show its name correctly

Before deletion
8716239--1178289--upload_2023-1-9_19-3-14.png

After deletion
8716239--1178292--upload_2023-1-9_19-4-0.png

this issue seems will also affect the base prefab, the deleated component in variant prefab also eliminate the names in the base prefab. And I could not assign names in base prefab anymore.
This reveal some issues under nested prefab workflow.
Could you please look into this problem? @SisusCo

These warning will happen each time I open unity now. Is there anyway to delete all meta data created by this plugin and remove ComponentName plugin safely?

Another Bug: In following two situations, you will see different names of same component of a same prefab( this prefab is a prefab variant of a base prefab)

  1. single click prefab in Project window, then inspector will show the components of that prefab
  2. double click prefab in Project window, then inspector will show the components of that prefab

Hey @JustusPan , thank you for letting me know about all these findings with prefab variants! I’ll investigate how to fix them.

This tool can be used to remove all component name metadata from the all open scenes or selected objects. It can be used both before or after Component Names has been uninstalled.

1 Like