Custom assets with Unity

Today I’ve taken the time to clean up the architecture of my VR stars Unity app (I really have to find a name for this project!). One really cool Unity feature is the ability to create custom assets by scripts run in the editor, so you don’t have to build complex structures at runtime.

Why is this so fantastic? Well, usually I would read star positions, constellation data, etc. from data files at application startup, and then create appropriate data structures and meshes. Strictly speaking, this isn’t necessary, since that data is essentially static. With Unity, I can now read all the data already at edit time, and create a complete “star sphere” with meshes for the constellations as a ready-to-use asset.

As a bonus, this also allows me to investigate the created geometry and data structures in the editor (see the picture), without having to resort to runtime debug utilities. Very nice!