- Home /
Public "char" parameter not showing on inspector?
I have the following code: public int damage; public char type; Strangely, only "damage" is editable in the inspector. If I change "type" to a string, it does show up, but I'd prefer to keep it as a string. Does Unity have some kind of limitation displaying public char variables?
Answer by Eric5h5 · Oct 12, 2013 at 04:10 AM
There are many variable types that Unity doesn't display in the inspector: char, short, ushort, long, uint, etc. You can use a type that Unity does display in the inspector (in this case, string), and convert it as necessary.
Answer by Kawaburd · Oct 12, 2013 at 04:10 AM
Ok, could be wrong with char specifically but not all types show up in the inspector. I'm having the same problem the XmlDocument type. You can create custom types and add [serializable] to make THOSE public, but it doesn't seem necessary here.
For something as simple as char vs. string, I'd just use the latter and only worry if you're doing something that'll actually hit performance (I.E. using A TON of them at once)