Skip to content

Entities Hybrid Baking

A simple utility to help convert GameObjects into Entities, while preserving the game GameObjects. Please note this operation is far less efficient than using Unity's Baking systems, but sometimes we need to preserve the original GameObject.

Example

On your GameObject, add the component ConvertGameObjectToEntity. This component will search for components that implement IGameObjectToEntityAuthoring to allow you to turn your components into Entities.

    public struct MySuperComponent : IComponentData {}

    public class MySuperComponentAuthoring : AGameObjectToEntityAuthoring {
        public override void ConvertComponentToEntity(Entity entity, EntityManager entityManager, EntityCommandBuffer ecb) {
            ecb.AddComponent<MySuperComponent>(entity);
        }
    }