Unity Tips – Serializable Classes

Clean up your inspector and group variables together with Serializable Classes! If you tag a POCO class with the [Serializable] attribute, Unity will be able to serialize it into the inspector for you.

Bonus tip, if you add a string field to the top of the class, Unity will use this as the name of the element when serializing these classes into an array – much easier to read and keep on top in place of ‘Element 0’, ‘Element 1’, ‘Element 2’ etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s