I often have systems, that wait for a singleton, that is created during baking. I want to cache that singleton, so I do not have to check in every update if it is available yet.
I have it as a private member in the ISystem struct, and I have state.RequireForUpdate<ThatComponent>(); in my OnCreate Method.
I thought that should be enough to delay OnUpdate until it is available.
Often that does not work, so I will check in the OnUpdate with a call to System.Api.TryGetSingleton<ThatComponent>(out _cachedComponent)) but that seems uncessary resource heavy.
Is there a correct way to do that?