#Authoring/Baking refuses to be called

1 messages · Page 1 of 1 (latest)

verbal radish
#

Hello! For some reason, the Bake() function for my only authoring script refuses to be called, despite the authoring script being attached to a single empty object in an empty Scene. It is supposed to bake a singleton entity storing configuration values.

I have tried setting the GameObject as Authoring/Mixed/Runtime. I have also tried adding the authoring script to an empty object within a new sub-scene. I cannot get the entity to bake. Any ideas what could be causing the issue?

The weird thing is that this authoring code used to bake. But I accidentally broke the subscene I had setup by deleting some assets. When I tried recreating the subscene, it refuses to bake. I have tried restarting Unity several times.

Here is the authoring code:

public class ConfigAuthoring : MonoBehaviour
{
    public GameObject unitPrefab;
    class Baker : Baker<ConfigAuthoring>
    {
        public override void Bake(ConfigAuthoring authoring)
        {
            var entity = GetEntity(TransformUsageFlags.None);
            AddComponent(entity, new Config
            {
                // Add Config values when I think I need them for debugging
                UnitPrefab = GetEntity(authoring.unitPrefab, TransformUsageFlags.Dynamic),
            });
            Debug.Log("Baked Config entity");
        }
    }
}

public struct Config : IComponentData
{
    public Entity UnitPrefab;
}
teal arrow
#

What's the scene setup looks like?

verbal radish
#

As simple as it can be. ConfigHolder is an empty GameObject with my authoring script attached.

teal arrow
#

Your subscene is added as additive game object scene

#

You need a game object with Subscene monobehaviour

verbal radish
#

Huh. I guess I missed that somewhere when setting it up again.

#

By the way, is it not possible to trigger authoring outside subscene? Can I not put the ConfigHolder just in the Main Scene?

#

I've tried that and it does not work, so I'm guessing it has to be within a subscene