How to set singleton component data before system OnCreate()

What is the best practice to get some predefined configuration values or other data from a MonoBehavior to available during system OnCreate? Is it just not possible?

It appears that baked entities are not present by the time systems are created. So, baking some configuration data (similar to PhysicsStep, for example) as an entity doesn’t help. You end up having to do a TryGetSingleton() check in OnUpdate and do some initialization there, and so on for every other system that needs that setup data. It seems less than ideal to have a bunch of initialization code in update functions.

2 Likes

We have plans to revisit it in the upcoming year, but for now I recommend putting the initialization in OnStartRunning and read it from a ScriptableObject or other serializable data source.

3 Likes

@jivalenzuela Were there any developments on this?

1 Like