x


How do you bind a c# model's property to the menu

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?

more ▼

asked Jul 25, 2012 at 06:02 PM

Macro gravatar image

Macro
207 36 46 60

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jul 25, 2012 at 06:04 PM

whydoidoit gravatar image

whydoidoit
54k 60 91 223

Oh well, thanks for the answer

Jul 25, 2012 at 06:06 PM Macro
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x10945
x629

asked: Jul 25, 2012 at 06:02 PM

Seen: 702 times

Last Updated: Jul 25, 2012 at 06:06 PM