Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Discussion Fresh Start - Scenes vs Subscenes and Best Practices

Discussion in 'Entity Component System' started by wolfadactyl, May 23, 2023.

  1. wolfadactyl

    wolfadactyl

    Joined:
    Nov 18, 2013
    Posts:
    5
    Hi all,

    I'm starting a fresh ECS project and wondering what peoples' thoughts are on best practices for Scenes and Subscenes. The documentation mentions the differences between authoring and entity scenes as well as Subscenes which can be a reference to either one, meaning previous workflows that only used a small handful of Scenes will potentially be a bit more complicated in ECS.

    Given that Scenes themselves are incompatible with ECS I'm wondering what peoples' thoughts are on how best to set up their projects. What are the main considerations you're taking into account when splitting up your Scene(s)? Does a monolithic Scene still make sense in the world of ECS? Is there a better workflow with a lightweight Scene which references authoring / entity Subscenes that you swap between or open / close as needed? Is anyone even considering or working with a micro-Subscene kind of architecture with their project?

    I'm sure there's plenty of opinions on the subject, curious as to what people are finding works best for them and what kinds of issues they've run into.
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,975
    I don't think there are any official best practices yet, but I usually have one scene loaded at a time, but that scene may contain many different subscenes. There are lots of ways to split up subscenes for different streaming or iteration workflows.
     
    bb8_1 likes this.
  3. wolfadactyl

    wolfadactyl

    Joined:
    Nov 18, 2013
    Posts:
    5
    Are your Scenes noticeably different with / without ECS, or is it basically the same just with Subscenes as a kind of cathall? Have you been splitting your Subscenes across packages (e.g. physics vs graphics / rendering) or functionality (e.g. combat vs UI) at all?

    Mainly curious as to whether or not people have found any major issues given the new overhead - e.g. sharing objects between Subscenes or the like. I realize it's all fairly new tech so people likely haven't put it through the wringer yet, but if there are things people have already found useful / problematic it would help people (like me!) optimize their workflows early.
     
    heartingNinja likes this.
  4. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,975
    Most things live in subscenes. So scenes themselves are much smaller with ECS than without. Otherwise there's not a big difference.

    You can't split subscenes by packages, unless you also split your GameObjects by package and somehow tie them together with some cross-scene referencing mechanism. Not worth it in my opinion.

    For procedural worlds, I will typically only have one subscene in a scene that contains all the spawners and configurations. For small designed levels, I may split subscenes by category (environment, enemies, ect) for faster iteration times since subscene import can be slow. For large worlds, I would split subscenes spatially so that they can be independently streamed.