Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Solved] Hybrid Conversion Broken or just me?

Discussion in 'Entity Component System' started by DreamingImLatios, Apr 30, 2020.

  1. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,222
    Apologies in advance for any harsh words that may follow. I am not in a good mood today. :mad:

    So besides the fact that Entieis 0.10.0 decided to straight up break all my custom ComponentSystemGroups by removing the ability to set a custom system update order, a couple of hacks later and I finally get everything compiling only to find that my camera is gone when entering play mode. The game itself otherwise runs fine, because I can see things in the scene view behave correctly.

    So with the Camera having a ConvertToEntity set to ConvertAndDestroy, I end up with a "Main Camera" entity that only has transform components.

    If I drop the camera into a subscene instead of the ConvertToEntity script, I at least get a camera, but my Entities.ForEach looking for the Camera component never runs because the "Main Camera" entity still does not have a Camera component in its archetype.

    Seriously, was this even tested?
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    It was intended. HybridRenderer team wrapped camera conversion in to define because of bug with cameras in editor (one of couple reasons).
    You should put HYBRID_ENTITIES_CAMERA_CONVERSION in to project defines and camera will convert again.
    Or mirror what they do in your GameObjectConversionSystem, if you don't want relate on defines
    Code (CSharp):
    1. Entities.ForEach((Camera cam) =>
    2.            {
    3.                AddHybridComponent(cam);
    4.            });
    And @SebastianAaltonen told me valid point, and I should agree, that Camera conversion never was oficially announced yet.
    "Camera conversion was briefly included and removed. Unfortunately DOTS package release happened during this period. We never mentioned camera conversion in the change notes either. Hybrid Entities was mostly broken in that release. Didn't work properly with standalone builds and couldn't handle multiple components in the same entity. It was never officially supported (or even working properly)'
     
    Last edited: Apr 30, 2020
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,222
    Well I apparently missed a conversation and a half!

    It has been a little more difficult this time around to track down these changes because the latest DOTS release has a bunch of white-space changes. I think I need a new git diff viewer for large changesets.

    Anyways, that define did the trick. So thanks for bringing that to my attention.
     
  4. rehawk

    rehawk

    Joined:
    Jul 17, 2014
    Posts:
    6
    Hi DreamingImLatios,

    have you found a solution to recreate custom system orders in ComponentSystemGroups?
     
  5. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,222
    I just updated to the latest packages. The old functionality is mostly fixed, although now marked obsolete. For the one spot I subclassed InitializationSystemGroup, I had to set UseLegacySystemOrder to true and then use this:
    Code (CSharp):
    1. protected override void OnUpdate()
    2.         {
    3.             foreach (var sys in m_systemsToUpdate)
    4.             {
    5.                 sys.Update();
    6.             }
    7.         }
     
  6. rehawk

    rehawk

    Joined:
    Jul 17, 2014
    Posts:
    6
    So you're using the custom system group just to add systems by the UpdateInGroup Attribute?

    I use the groups to add my system manually. In my opinion the attributes are a horrible way to define the update order.
    Here's how I do it. But in the 0.11.0 this way doesn't work anymore.


    Code (CSharp):
    1. protected override void OnCreate()
    2.         {  
    3.             base.OnCreate();
    4.            
    5.             AddSystem<BarrelTaggingSystem>();
    6.            
    7.             AddSystem<FiringSystem>();
    8.  
    9.             AddSystem<SingleProjectileSystem>();
    10.             AddSystem<EnableRenderingSystem>();
    11.         }
    12.        
    13.         public override void SortSystemUpdateList()
    14.         {
    15.             // Disabled sorting to preserve the adding order.
    16.         }
    17.  
    18.         private void AddSystem<T>() where T : ComponentSystemBase
    19.         {
    20.             AddSystemToUpdateList(World.CreateSystem(typeof(T)));
    21.         }