Search Unity

Feedback GameObjectConversionUtility not working consistently.

Discussion in 'Entity Component System' started by georgeq, Mar 9, 2020.

  1. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I have 2 projects and in both I'm using this code to convert a prefab into an entity:

    Code (CSharp):
    1.  Entity wallBlockPrefab;
    2.  
    3.       using(BlobAssetStore blob = new BlobAssetStore()) {
    4.  
    5.          wallBlockPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(WallBlockPrefab,GameObjectConversionSettings.FromWorld(dstManager.World,blob));
    6.  
    7.       }
    As you can see in the images below, the prefab set up is exactly the same, but the results are completely different.

    Project A:

    goc1.png

    Project B:

    goc2.png

    This is a "per-project" issue, but I cannot see why. I have the same packages, same version, installed on both projects. And both run under Unity 2020.1.0a24
     
    Last edited: Mar 9, 2020
  2. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Isn't Project B missing the Hybrid Render package?
     
  3. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Yes, thank you!... that was the problem.... however:

    1) I don't remember having to install the Hybrid Renderer manually when I created Project A on 2020.1.0a21... Don't take my word for it, but as far as I can remember it was installed automatically when I installed the Entities package.

    2) If my memory is failing, and I did have to install the Hybrid Renderer manuall. I don't see the reason why, it should be excluded from the entities dependencies. If the Entities package already installs the Job System, the Busrt compiler and everything else, why to leave behind the Hybrid Renderer?... it just makes no sense.

    3) If GameObjectConversionUtility.ConvertGameObjectHierarchy finds a component which cannot be converted for any reason, an error or at least a warning should be logged at the console.
     
    Last edited: Mar 9, 2020
  4. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    1 and 2) Hybrid Renderer package has Entities package in dependencies, so you can just install the Hybrid Package

    3) You can inspect the conversion result if you have the DOTS Editor package installed, but it only works with GameObject inside of sub-scenes.