Search Unity

Why enforcing transform conversion?

Discussion in 'Entity Component System' started by alexandre-fiset, Oct 2, 2019.

  1. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    Why is it absolutely necessary to add Rotation, Translation and other transform related components to ALL entities converted from GameObjects?

    I mean, it truly is practical to be able to visualize parameters and so on in the editor, but a lot, if not the vast majority, of use cases do not require anything related to transforms.

    Right now we are forced to create our own custom converter while I believe it should be built in the conversion system.

    My suggestion would be to add some additionnal options to the ConvertToEntity script such has ConvertTransform boolean...
     
    alexnown likes this.
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    I would ask different question, why do you require GameObjects, if you don't need Transform/Translation?

    What is your use case scenario?
     
  3. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    I require prefabs and gameobjects so that artists and designers can manipulate the data outside of scripts.
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    What you could do for now, is to remove Translation components. Or once you got converted entity, get only relevant data, to create target entity(ies). Then either delete, or ignore converted prefab entity.
    You can automate that, so artists won't see any difference, of what is happening behind the scene (during conversion).
     
  5. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    Why not Scriptable Object?
     
  6. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    This is what I do (removing the components) but this happens in so many conversions that I'd like it to be a setting rather than an enforcement.

    If I have an object that may exist several times in a scene but with different settings, I'd need to create one SO per instance, whereas a single Prefab can have different overrides accross spawned instances.
     
  7. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    It's been a while but can't you just add the static optimise component and it won't add the translation, rotation, scale components during conversion.
     
  8. alexnown

    alexnown

    Joined:
    Oct 25, 2018
    Posts:
    22
    +1, for my usecase i dont need TransformConversion at all. I'm using custom rendering system with MPB support, so in editor all my meshes are game objects, after conversion = entities with excess components (Translation, LTW, Parent etc.)
     
  9. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    While unintuitive, that is nice to know :D