#How to ship hybrid DOTS/Monobehaviour content

1 messages · Page 1 of 1 (latest)

agile forge
#

I'm trying to create a DLC shipping system so I can create hybrid ECS/MB scenes, export them, and import them into my build at runtime. In the past, for purely MB projects, I've used AssetBundles for this, packing my scene and its dependencies into an AssetBundle (and dumping all the code in the referenced assemblies into a DLL) and then importing and loading those from a level selection screen at runtime. Works great, but I'm struggling to get this to work for ECS.

I've found that AssetBundles and addressables don't support ECS, and that "Content Management" does, but I'm unsure if CM is also going to work for my non-ECS stuff

For context, my scenes follow a setup where the actual environment is implemented with regular gameobjects, as is all the frontend/player control stuff, those player control monobehaviours then talk to the subscene to make the ECS stuff happen. E.G a monobehaviour control panel to control an ECS simulation/visualization tool

This means its not enough to just export the subscene, I need to be able to export the entire scene around it, with all its Monobehaviours, and crucially, maintain the link between those two sides.

Will ContentManagement let me do this? Or will I need some hybrid solution that uses both ContentManagment and Addressables/AssetBundles?

I've read through the Unity docs, but I'm still left with a pretty unclear picture on all this. Does anyone know of any complete walkthroughs/tutorials of creating a DLC system with hybrid ECS/MB content?

Cheers!

sage flax
#

I have no idea but I'm also interested in the answer.

tough fjord
#

Content management can store unity Objects

agile forge
#

It seems the unity objects themselves aren't the only problem (side note, I've found you actually CAN use AssetBundles, as long as the scene you're exporting doesn't contain a subscene, and you instead author your entities at runtime manually by creating entities and adding components with the EntityManager)

The BIG problem is components, Unity really, really wants all the IComponentData types to be known at compile time. When importing my DLC, I've tried shutting down the type manager, AND the world, creating a new type manager, manually registering all my IComponentData types, and then recreating a fresh world... but still no joy, I still get the same error telling me that the component types need to be known at compile time.

I'm now trying to get my DLC itself to do the above process... also can't imagine I'll have much luck... the TypeManager will belong to the main program rather than the DLC

agile forge
#

Yep, no joy on the above

agile forge
#

I’ve settled on the fact that loading in new components at runtime just isn’t doable, but I should at least be able to load systems, right?

Right???

Well, I can’t for the life of me figure out how. I had hoped that just having the system be part of the DLL that gets loaded at runtime would be enough to get that system added to the world automatically, no such luck, I’ve tried doing it myself, from both the main program, and inside the DLC assembly itself, where I know what the concrete types are, e.g

`var boidSpawnSystem = (BoidSpawnSystem)Activator.CreateInstance(typeof(BoidSpawnSystem));
world.AddSystemManaged(boidSpawnSystem);

var boidSimulateSystem = (BoidSimulateSystem)Activator.CreateInstance(typeof(BoidSimulateSystem));
world.AddSystemManaged(boidSimulateSystem);

world.Update();
That code all runs through fine, but the system still doesn’t actually seem to appear anywhere`

Anyone have any ideas??

tough fjord
#

hmm i've not really had any issues loading extra systems from dlls

#

but timing here is very important

#

when are you loading it?

#

if you're loading assemblies that have burst you must use
BurstRuntime.LoadAdditionalLibrary(burstedAssembly);

tough fjord
#

I'm assuming you're the same Tovey-Ansell on forums? the code you posted there doesn't work and I responded

agile forge
#

Lol yeah that's me - I'm loading the system at runtime when the user selects the DLC from the menu, I really can't do this any earlier. But registering systems works on initial boot, then that means the system doesn't need to be baked in at compile time anyway, so surely it should be doable to register the system later on