Search Unity

New SubScene & ConvertToEntity workflows

Discussion in 'Data Oriented Technology Stack' started by Joachim_Ante, Mar 4, 2019.

  1. PublicEnumE


    Feb 3, 2019
    @Quantum1000 Does is also separate women and girls?

    All this separation......Why?....
  2. thelebaron


    Jun 2, 2013
    Bear with me on the phrasing of this question -
    With entity conversion/prefab referencing is it an issue that prefabs seem to be, for lack of a better term, "unique" when there are multiple of the same type, originating from multiple entities that also pretty much the same?

    Example: I have a "Door" entity, that can be destroyed. Stored on it is a buffer of five "Destroyed door entity prefabs". But if I make a duplicate of that Door entity, for its own buffer are five different(but same) Destroyed door entity prefabs.

    How do I go about making it so that I'm not just needlessly creating extra entities for something like this? This situation isn't such a big deal for one off objects, but if say I wanted every part of the game to feature destruction like this wouldn't it be inefficient to have this kind of a situation?
  3. Thaina


    Jul 13, 2012
    It's not that I try to troll you, that was the pure question. There was no solid line to separate between it inherently both in prefab and subscene or in man and boy so we should have put more thought about use case scenario and definition
  4. LazyGameDevZA


    Nov 10, 2016
    This is somewhat of a complex question. I'll have to find some time to put together a test, but my suspicion is that if you have multiple GameObjects in your scene each at the root of the scene being converted to an entity there will be duplicate prefab entities created.

    If my assumption is correct putting the doors as a child of an object in your scene and having them all convert as part of the same hierarchy should yield non-duplicate prefab entities. It's a bit of a hacky solution to be honest, but that said if you then convert that to a subscene that can be loaded you'll gain a little in startup time.
  5. MikeMarcin


    May 15, 2012
    SubScenes can be preconverted to ECS representation so you never need to load the GameObject representation at runtime. These SubScene ECS forms can be streamed in very efficiently at runtime. Prefabs are stored as GameObjects inside of bundles (and also stored in the Scene iirc). You can convert a GameObject prefab to an ECS prefab but this happens at runtime.
    Thaina likes this.