Prevent unity transforms from being added to Entity prefabs?

I have some prefabs for entities that don’t need transforms on them at all. I don’t see a way to prevent a prefab set up in the editor from including transforms, and so my prefabs all end up with Translation/Rotation/Scale/LocalToWorld. This results in the TRS to Local To World system doing a lot of work every frame that is completely unnecessary (I’m instantiating a lot of some of these positionless entities).

Is there something I’m missing, or do I need to do something really weird like manually removing the transform components from the prefab before instantiating copies of it?

You can create an authoring component and attach it to the prefabs you don’t want transform components on.

public class RemoveTransformAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        dstManager.RemoveComponent<Translation>(entity);
        dstManager.RemoveComponent<Rotation>(entity);
        dstManager.RemoveComponent<NonUniformScale>(entity);
        dstManager.RemoveComponent<LocalToWorld>(entity);
    }
}

Correct me if I am wrong, but I believe Local to World is required if you are using the Hybrid Render system. You would need to write you own Entity Data authoring component and don’t add the component object link GO transform to the data entity.

I ended up writing an initialization system that removes Translation, Rotation, RotationEulerXYZ, Scale, and NonUniformScale from both active and prefab entities that don’t have SpriteRenderer. Since it’s stripping off the prefabs as well, basically doesn’t need to run more than once so it’s not thrashing entities across chunks constantly.

Works well for my use case, since I’m doing a 2D game and have my own simpler transform components and in a lot of cases I’m doing my own rendering for better optimized batching.

Would be nice if you could opt out of transforms as part of the default workflow in the future though.