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 site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
6 People are following this question.
Multiple Cars not working
Distribute terrain in zones
Pause Menu Text Not Rendering
How do I play an animation from another object C#
Illuminating a 3D object's edges OnMouseOver (script in c#)?