x


C# - public variable not exposed to the Project Panel? (n00b to c#)

I have been working in Unity using Javascript for about a month, but now that I am using SmartFox with Unity I am finding it a requirement to switch to C#. I cannot seem to find a way to make a variable declaration that is "public" (ie. accessible to other scripts) but is not exposed to the Project Panel (I don't want 20 unneccessary variables listed on my GameObject in the panel). How can I do this if the variable is going to be dynamic (I tried static variables but can't seem to change them, which makes sense in hindsight). From what I understand, simply declaring the variable makes it private by default, and setting it to private seems to always expose it to the Project Panel, which I definitely do not need.

Sorry for the n00b level of my question, but the conversion is a bit overwhelming at this juncture (especially since I wasn't that skilled with Unity's Javascript to begin with).

Thanks in advance!

more ▼

asked Nov 04 '11 at 10:17 PM

geekedatbirth gravatar image

geekedatbirth
16 7 7 8

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

1 answer: sort voted first

Put the attribute:

 [HideInInspector]

before the public variable declaration.

more ▼

answered Nov 04 '11 at 10:31 PM

Peter G gravatar image

Peter G
15k 16 44 136

Thanks so much! worked perfectly.

Nov 04 '11 at 10:46 PM geekedatbirth
(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:

x4144
x819
x74
x30
x7

asked: Nov 04 '11 at 10:17 PM

Seen: 1105 times

Last Updated: Nov 04 '11 at 10:46 PM