#Converting gameobjects to entities at runtime

1 messages · Page 1 of 1 (latest)

mystic maple
#

I’m aware that we use bakers to “bake” gameobjects into entities, I think probably because of the complexities of gameobjects and how they needed to be simplified to entities. But is it even possible to do that at runtime? If yes, how?
The reason I’m asking is that I want to setup a dynamic content delivery system where the game would instantiate a given gameobject as an entity.

And related to that(I should probably make this a separate thread but does unity’s cloud content delivery addressable system support dots?

willow jolt
#

afaik anything addressables doesnt cover entities, which has its own content loading system in the docs.

runtime conversion is really just: get the entitymanager, create entity, add your components to it. the complexity of things will depend on what you want to add to it, graphics has some helper utilities(documented the entities graphics docs) to simplify things for runtime, whereas physics does not.

drifting berry
#

also keep in mind if you plan on using Netcode for Entities, that Ghost serialization happens during baking which decides on the structure of snapshots, so adding components or removing them from ghosts at runtime also doesn't work without some "re-baking" trickery i haven't attempted.

gusty flame
#

Entities has it's own content delivery system

#

you practically just bake subscenes and send them over network

#

this is how you update content without code changes

#

so whatever you want to recreate with it will require you to:

  1. Recreate conversion workflow
  2. Recreate content delivery
mystic maple
#

I don’t like the sub scenes method… anyways thanks you guys for the information!
I guess I’ll have to go with the really tedious process of copying the essentials from the gameobjects and setting them up to their respective individual components on the entities.

warm garden
mystic maple
#

Nothing except it really doesn’t suit my game design style

willow jolt
#

its a lot of work to recreate the baking pipeline if you plan on having a lot of varied entities

bright steppe
#

can’t bake at runtime. create a new one and addcomponent. However I think baking in a subscene and use it like a assetbundle is a better way.

gusty flame
#

Don't think of them as scenes in unity

#

I can't imagine how any game can not suit asset bundles