How do you actually structure loading your assets and entities at runtime using Baking and a Factory pattern?

Hi,

I believe I have a pretty good understanding now of how DOTS works in Unity having playing with multiple samples, looking at well made tutorials and videos and implementing a couple of fun small prototypes.

But now that I’m starting a new full feature game and thinking on how I will structure it, I get confronted with many questions that I fail to find answers either in these discussions or on the web.

The main blocking point I have now is about structuring my game assets and loading them at runtime: I just don’t know what approach I should be using.

I won’t get into much details of my game as it is irrelevant but rather simplify my use case to get a simple answer that I can evolve from. :wink:

(btw, I have an hybrid approach to my game development using both GameObjects and Entities when it makes sense)

Let’s say that I want my game to allow the player to choose between multiple predefined avatars, say 3 for the lack of simplicity.

Since I’m planning to add more in the future, I don’t want the avatars to be loaded when the game starts but rather when the player gets to select which one he wants to use.

In that case, the Authoring/Baker approach of a set of prefabs isn’t a good option as I understand that all prefabs will get loaded in memory if I do so.

I therefore tried a different approach using an Authoring Monobehaviour script that would bake all meshes and materials and have them applied to a manually constructed entity using RenderMeshUtility as per described in this link: Runtime entity creation | Entities Graphics | 1.2.4

It does work but it feels like a pain when introducing more avatars or evolving its implementation when adding new features (or components).

What would be anyone approach on such use case?
Thanks