#GameObject not baking while having bakers assigned

1 messages · Page 1 of 1 (latest)

alpine dew
#

I have a gameobject in the ECS scene with the following script:

using Unity.Collections;
using Unity.Entities;
using UnityEngine;



namespace CellEngine.World
{
    public class CellProviderAuthoring : MonoBehaviour
    {
        [SerializeField] private CellAuthoring[] _cells;
        
        
        public class CellProviderBaker : Baker<CellProviderAuthoring>
        {
            public override void Bake(CellProviderAuthoring authoring)
            {
                Entity entity = GetEntityWithoutDependency();

                NativeArray<CellPrefab> prefabs = new (authoring._cells.Length, Allocator.Persistent);
                
                for (int i = authoring._cells.Length; i --> 0;) {
                    CellAuthoring cellAuthoring = authoring._cells[i];
                    
                    Entity prefab = GetEntity(cellAuthoring.gameObject, TransformUsageFlags.None);
                    CellType type = cellAuthoring.cellType;

                    prefabs[i] = new CellPrefab(prefab, type);
                }
                
                AddComponent(entity, new CellProvider(prefabs));
            }
        }
    }
}

However, when starting the game, it does not appear to have created an entity with the CellProvider component

#

After some fiddling around, it seem like i've magically fixed the issue

light jolt
#

you can't bake native containers

#

use dynamic buffer instead