1
\$\begingroup\$

I am trying to use an enum so that it is available in the inspector. This code works:

public ArmorTypeEnum ArmorType;
public enum ArmorTypeEnum { Light, Medium, Heavy };

How can refactor it into a single line?

How can I make ArmorTypeEnum private while keeping ArmorType public?

\$\endgroup\$
1
  • \$\begingroup\$ You could make it internal in another Assembly, maybe. I'm not sure. \$\endgroup\$ – Vaughan Hilts Mar 19 '15 at 3:39
2
\$\begingroup\$

You can't make your enum anything other than public if you want ArmorType to be public too. See Restrictions on Using Accessibility Levels (C# Reference).

If you don't want to use an enum, and just want a selection in the inspector, you can use a property drawer to show a selection of strings in the inspector.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.