Basically when I make a public variable in a class of MonoBehaviour an unsigned integer in C# the Inspector does not add them. They work fine though, the code compiles and runs normally. I just can’t let the designer edit them. Changing them to integers or floats makes them pop up in the Inspector.
Is this a bug? Can I work around it?
Here’s a code example if you so dearly desire. Tile Size will show up, Width and Height won’t.
public uint m_Width = 50, m_Height = 50;
public float m_TileSize = 1.0f;
It is not a bug. They just haven’t been implemented in the inspector code. Long does show up on the inspector, so if you really really require only positive, huge, integer values, you can use a long and then use the OnValidate method to check for negative values, or the Range attribute.
Unity’s built-in serialization doesn’t handle uints, which is a bit of a bummer.
If you really need a workaround, check these other two threads:
You can write your own editor script to clamp or otherwise manage values. You can ultimately serialize an array of bytes, if you’re really set on using uints.
Running Unity 5.5.0f3, I can confirm that Unity now supports the display of
uint types in the inspector.