Prefab Conversion to ECS Workflow

I’m having trouble getting the conversion workflow with Prefab’s working. I basically want prefab serialized references in my DOTS subscene to be automatically included in the conversion process. I’m using Unity 2021.2.7f (for some reason 2021.2.12f and 2021.2.13f resulting in crashes) following the methods shown here.
From my understanding this involves attaching an authoring tag onto the prefab itself, then a system to find a declare those prefab references based on those tag – here’s a screenshot of my code (code blocks and embed images weren’t working).

Authoring components in my subscene contain references to “PrefabAuthor” but the Entities.Foreach still never actually finds any matching queries and so is never called. I’ve also tried implementing the IDeclareReferencedPrefabs interface but found that that is never called either…

Is there a way to automatically include prefabs in the asset database (and not an open scene or subscene) in the conversion process? Or must all Objects to be converted to entities/Components be in subscenes? What am I doing wrong here?

The Prefab itself does not need an Authoring Component. The Authoring Component has to be on one of your GameObjects in the Scene and contain a reference to the Prefab.
Your ConversionSystem then gets all those SceneObjects with the Authoring Component and declares a Reference to the Prefabs referenced in your Authoring Component. This in turn triggers the conversion of those referenced Prefabs.

1 Like