I was wondering how you go about getting properties to appear in the menu for game objects. For example if I had a custom script which had a Name property (with public getter and setter) and was applied to a cube how can I make a field in the menu for someone to fill in the Name for this game object.
I thought it would be done via attributes, and saw the AddComponentMenu attribute, but this doesnt seem to have had any effect. Could someone point me in the right direction?
Answer by whydoidoit
Jul 25, 2012 at 06:04 PM
The only way you can expose properties is by writing a Custom Inspector for your class. See here. Unity does not support properties in the default inspector view - it bugs me too, but there you go.
Oh well, thanks for the answer
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
6 People are following this question.
Distribute terrain in zones
Multiple Cars not working
Illuminating a 3D object's edges OnMouseOver (script in c#)?
Struggling with my pause menu and main menu
How to make a slider menu