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

Feature Request Skip Transform conversion

Discussion in 'Entity Component System' started by PhilSA, Jul 24, 2022.

  1. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I fairly often need to make entity prefabs that don't need any transform components (skill/buff prefabs, etc). However, the "TransformConversion" system in the Entities package provides no mechanism for skipping this (as far as I know), and so all Entity prefabs will automatically have transform components added to them.

    It would be very useful to have a checkbox on the gameObject Transform component where we can control whether it converts or not. It could also give you the option of choosing between a UniformScale component or a NonUniformScale component, because it can sometimes be tedious to manually enforce this

    But does anyone know of a good way to solve this right now, other than writing our own conversion system that updates after "TransformConversion" system and removes everything? Making the transform static seems like it would get rid of part of the unwanted components, but not all
     
    Last edited: Jul 25, 2022
    Krajca and Tony_Max like this.
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,223
    Remove the Transform component on the authoring entity before the TransformConversionSystem runs.
     
  3. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Tried this but Unity won't let me:
    I'm doing it with GameObject.DestroyImmediate(). Do you know of another way to do it?
     
  4. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,223
    Code (CSharp):
    1. EntityManager.RemoveComponent<Transform>(authroingEntity);
    The only way to get the authoring entity currently is via Entities.ForEach or EntityQuery on the conversion system's EntityManager (and not DstEntityManager).
     
    Arnold_2013 and PhilSA like this.