Search Unity

Official New SubScene & ConvertToEntity workflows

Discussion in 'Entity Component System' started by Joachim_Ante, Mar 4, 2019.

  1. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Just to throw this out there, I know DOTS on 2021 is not 'officially' supported, but I have found very few things so far that don't work (It could just be lucky and I am just not using a large variety of things). I am using ECS, the physics package, etc, and the only reason I found out that it wasn't 'supported' after having been using it for months was the 'DOTS Editor' didn't work properly, so I went to look it up on here and that's when I found out. I just didn't use the dots editor and have been continuing on just fine otherwise.
     
    bb8_1 likes this.
  2. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    761
    Interesting, thanks for the info. I have actually been pondering that question for a while. When 2021 first came out there wasn't a warning about DOTS incompatibility so I upgraded and it seemed like my game was running ok (or maybe there was a warning and I just didn't see it). Once I found out about the incompatibility I chickened out and downgraded, thinking that there might be monsters hiding under the bed. Maybe when I get to a good stopping point I'll give it another shot.
     
    Last edited: Jan 10, 2022
    adammpolak and bb8_1 like this.
  3. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    Yea I feel you :(
     
  4. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Hi, I'm struggle to make the method Convert (of IConvertGameObjectToEntity) to get called, at runtime, when I add/instantiate a GameObject (witch implement IConvertGameObjectToEntity) in a loaded subscene.

    The scene is loaded with 'LoadSceneAsync' and the 'Flags = SceneLoadFlags.LoadAsGOScene'. Like so:

    SceneSystem.LoadParameters loadParams = new SceneSystem.LoadParameters()
    {
    Flags = SceneLoadFlags.LoadAsGOScene
    };
    var SceneEntity = _SceneSystem.LoadSceneAsync(SubScenesRef.Instance.Table_KeyValuePairText_Root.SceneGUID, loadParams);
     
  5. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    Subscene conversion doesn't happen at runtime. Everything has already been converted before you enter the game and it just loads the converted data off disk into the world.
     
    DavidLe360 likes this.
  6. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Yea I know that subscene are already converted, but once it's is loaded, at runtime, we can't dynamically add/convert any new GameObject into it!?
     
  7. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    761
    So we can just ignore these warnings?
     
  8. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    For the first time you can ignore this issue. But later when it comes to processing all the Sub-scenes in different scenes cause ugly lightning behaviors, if they all have different settings.

    A) I think you should create a main scene with correct settings and save it as an empty copy.. So if you need a new scene use the copy. But that sucks anyway, because the lightning conditions are mostly a part of the latest to-do entries.

    B) I know it's possible, you can create a script that copy the Lighting Settings from the main scene to the current scene. But its also a bit ugly to realize. To do this, you should define a folder where are all scenes are saved including the main scene. Each new scene got a script that gets the Lighting Settings from the main scene in this predefined folder.

    Anyway you should urgently test your version on load and unload scenes containing Sub-scenes..
    There is a horrible bug when loading scenes cause a material memory leak. Each time you load a new scene and unload another, the materials will not be correctly updated / removed from the memory. Materials and Textures should be pre loaded into the main scene. But you should test this for real.

    Good luck! :)
     
    lclemens likes this.