For our project we cannot use the hybrid renderer, however we want to be able to pre-cache data within a subscene. Basically setup a subscene with a bunch of pre-created entities and GameObject’s that represent view logic tied to them. From what I can tell something “prevents” GameObject’s from a subscene to be rendered in the game view at runtime. Is there a way to get this functionality?
The solution that I came up with was to have two scene, one an additive scene and one a SubScene. I wrote an editor tool that instantiates “pooled” GameObject’s that have a “GameObject” representation and an “Entity” representation. These objects are assigned unique id’s. At runtime I load both the SubScene and the additive scene in. When the loading is complete I pair them together at runtime in a dictionary using their unique ids.
Because it is a fixed pool I create a fixed size TransformAccessArray
which goes through the Entity->GameObject (Transform) link every frame and sets the linked Transform’s position to the entities translation component position. This is fairly fast since it’s multi-threaded transform writing.
Unfortunately I could not get this approach working with Cloud Build as it requires using .buildconfiguration to build from com.unity.platforms. So I ended up moving the SubScene logic into a runtime instantiation and abandoning using SubScenes.
You can just don’t install the Hybrid Renderer package, you don’t need it to use the Entities package.
You can use AddHybridComponent(myMeshRenderer);