Search Unity

Feedback GameObjectEntity versus Convert to Entity Workflow

Discussion in 'Entity Component System' started by sethwklein, May 24, 2019.

  1. sethwklein

    sethwklein

    Joined:
    Oct 24, 2014
    Posts:
    8
    My small team is using a little of GameObjectEntity and ComponentSystem's with ForEach to control some of our game objects.

    We have very little code, so we don't care much about performance. (I say that as someone who sometimes cares irrationally much about performance.) But we all love the programming style. I say it feels like someone took the handcuffs off and I can program again.

    For us there are two barriers to switching to the convert to entity workflow:

    1. I believe it doesn't interoperate with existing MonoBehaviours because the GameObject's go away at runtime. This makes it more difficult to switch incrementally.

    2. You can browse the entities in the entity debugger, but it doesn't tell you which entity is responsible for what in the scene view. This is in contrast to clicking on a GameObject in the hierarchy view which will highlight something in the scene view.
     
  2. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    I believe you can use both the conversion workflow and still using the monoBehaviours by using the ConvertToEntity instead of GameObjectEntity and select the inject option.
    This will create an identical entity representation of your prefab and let you the GameObject in the scene to interact with it and do your stuff.

    When your prefabs will be 100% convertible to entities your project will take advantage of the conversion workflow and it's huge performance, like fast instantiation and applying custom logic to each prefab instantiated in worker thread ....
     
  3. sethwklein

    sethwklein

    Joined:
    Oct 24, 2014
    Posts:
    8
    I'll add that to my list to look into. Thanks!
     
  4. sethwklein

    sethwklein

    Joined:
    Oct 24, 2014
    Posts:
    8
    As long as Hybrid Renderer isn't in the project, that works. Thanks! (If Hybrid Renderer is in the project, then you get the cube you can't select in the scene view AND the one you can.)
     
  5. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    The ConvertToEntity -> "Convert and Inject GameObject" will not destroy your MonoBehaviours and will let GameObjects in Scene using the HybredRendererV2 does not affect this functionality.
     
  6. Knightmore

    Knightmore

    Joined:
    May 11, 2012
    Posts:
    227
    Yeah that is normal behaviour as two rederer parts are active: one for the mono world and one for the entity world. Just keep them in Sync with "CopyTransformToGameObjectProxy" to not have both GO/Entity off each other.
     
  7. CWatsonT2

    CWatsonT2

    Joined:
    Jan 9, 2019
    Posts:
    114
    I'm also doing this and having trouble. If I use CopyTransformFromGameObjectProxy it adds GameObjectEntity and doesn't render in the game view when played. If I use both those components plus ConvertToEntity with ConvertAndInjectGameObject I get the behavior I want but now I'm doing double the rendering. What's the point in that? How do I get just the single render on the entity? I've tried turning off the meshrender in script but the entity ends up being created without a renderer. I can only get that to work with a coroutine and delay before disabling the meshrenderer and I'm still getting the double rendering overhead until it's disabled.
     
  8. Deleted User

    Deleted User

    Guest

    Is there any way to have synchronization of Editor changes with Convert and Inject workflow? Current workaround is to have Proxy with GameObjectEntity that will allow do changes in Play mode and have them serialized with ECS.
     
    Last edited by a moderator: Jan 26, 2020