Where/How to store reference to multiple Entity prefabs for ghosts

How should one go about referencing spawnable entity prefabs accessed by ID? As far as I can read you shouldn’t store EntityPrefabs in blobs. And directly using arrays doesn’t seem to be allowed for Entities.

My situation is that I have ghost entities which can have a larger number of visual representations by faction/skins etc.

Additional follow up, if I wanted to load this memory efficient, like e.g. using subscenes for the different EntityPrefabs I guess, is there any goto way already of doing this without building your fully own resource managing system?

Thanks for any insight.

1 Like

I have completely eliminated any graphical representation on the ghost itself and I have deferred graphical ghost object spawning into another system that not only loads the model but other additional data that I didn’t want synced.
So, in my server spawn system after instantiating I then make a RPC call which has all the data (modelId, classId, stats, etc…)

The RPC system on client then loads all the data and model onto the ghost. Downside is that the ghost is only visible and really ready after the RPC call and not the ghost spawn. As it’s only for players I don’t mind that much.
For faster spawning ghosts I’d sync a model id.

1 Like

I am building a moba-like game and have similar needs.

In attempting to solve this problem elegantly I have had three primary goals:

  • Art/designer-friendly workflow for setting up/testing Animators/SkinnedMeshRenderer

  • Create as few disparate sources of data as possible needed to instantiate an entity

  • Avoid using MonoBehaviors/Singletons to store/lookup data in systems

To instantiate Entities by EntityPrefabReference
Create component with members pointing to each PrefabEntity and access it is a singletoncomponent from jobs

To instantiate client-side-only GameObjects for rendering / animation / audio
Create authoring component that points to a GameObject’s Transform.
Authoring component wraps that reference in a SharedComponent that is attached to the Entity.
Client-side system looks for Entities.WithAll.WithNone and instantiates an instance of the references gameobject inside a IStateComponentData wrapper Component. This system also looks for Entities.WithAll.WithNone to destroy the gameobjects associated with destroyed entities.

I am happy to share actual code if that would be helpful as well. This problem is very awkward currently and I would LOVE to be informed of a better way but this is what I am using currently.

Additionally, I wonder if most people are using client-side-only gameobjects to actually render their characters/animated stuff? I have just not found the current state of HybridRenderer and Animations to be worth the hassle for this stage of development. Again, I’d love someone to enlighten me if this is just wrong.