- Home /
How do I show a custom dynamic string instead of the script name of a MonoBehaviour component in the Inspector?
Hi everyone,
I'd like to replace the Labels with the script names with custom strings taken from a field inside a script MonoBehaviour.
I have a situation where several components from similar classes could be present on the same gameobject and this is rather confusing when inspecting them when inside a list of MonoBehaviours, and when collapsing the scripts.
In short, in this image:
I'd like to show the contents of the Name field instead of the very first line "Action Show Overlay (Script)"
I've seen people using or naming attributes I wasn't aware of, such as [Display(FormatMethod = "FormatBehaviour")], (https://github.com/vexe/VFW/issues/27) for which I can't find any documentation for, so I was wondering if some hidden or obscure way to rename not just the first script component but each one in the image would be possible.
I'm looking to do the same thing, does anyone know if as of Unity 2020.2.1, something like this is supported?
Answer by logicandchaos · Jan 14, 2021 at 01:58 PM
You should make all the actions SOs and then make on script to manage them all. That will tidy everything up.
Your answer
Follow this Question
Related Questions
Enquiry on what are the maximum number of components for a specific object in Unity 1 Answer
Should I pool an object that only spawn every second? 1 Answer
Verify if a Component is null 3 Answers
Add AudioSource-Like Range to Script 1 Answer
How to fix the problem with joint! HELP I CAN NOT UNDERSTAND! 0 Answers