by TheBloggerator | Jan 15, 2022 | C# Tips
Serialize properties in Unity easily. This wasn’t possible until about a year ago and has quietly slipped under the radar as far as I can tell. I was extremely surprised to find this nugget in a Unity forum where a request was made and several years later the concept works. Without using auto-properties this cut from 6-7 lines to 2 lines. It is so clean and is a new favorite feature.
by TheBloggerator | Jan 5, 2022 | C# Tips
I like simple, and I like for Unity to handle as much of it as possible. To that end, are two solutions here. First, to just create a class or struct as a data container and make a List of that class or struct, or secondly, to implement your own dictionary that includes the inspectable bits. Where this becomes a better solution is that this new class can hold all the data you want and as long as the types can be serialized individually by Unity and is the same usage as a normal dictionary, then it will all be displayed in the inspector. I’ll provide examples below.