- Home /
Inspector attribute for showing a field with a custom name? Possible?
Hullo!
I have a UI class containing a load of settings for different elements in my game. I like to keep my inspector tidy using attributes. But here's my question. Can I somehow display a field in the inspector with another name than the name of the actual field in script, obviously while keeping the same name in the script? For example, the class contains settings for two types of texts, both these text have a default position that I change in the inspector. At the moment I have something like this:
Text 1:
Text Number One Position X [ ..... ]
Text Number One Position Y [ ..... ]
Text 2:
Text Number Two Position X [ ..... ]
Text Number Two Position Y [ ..... ]
What I'd like to achieve is having the inspector display something like the following:
Text 1:
Position X [ ..... ]
Position Y [ ..... ]
Text 2:
Position X [ ..... ]
Position Y [ ..... ]
Answer by Suddoha · Sep 16, 2015 at 03:04 PM
Custom Editors will help you out of the misery ;)
Thanks! All tough it looked like a bit of work time overkill to use this just for changing some names... But oh well, if there's no easy attribute for this (why isn't there? ) then I guess I'll just have to swing with the inspector printing the actual names. Thanks anyway! :) :)
The scripting reference contains better examples in both languages and is more up to date, here http://docs.unity3d.com/ScriptReference/Editor.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612033947im_/https://answers.unity.com/themes/thub/images/avi.jpg)