Baked component access in ISystem onCreate()

I am still relatively new to ECS and perplexed about some workflow.
The intention is to have a settings component or entity that stores various things used by a number of systems and can be changed in the inspector.
I am new to ecs and watched a couple of tutorials and read through some documentation the main tutorial leading me to the approach i am currently attempting was from Turbo makes Games. Here he creates a mono behaviour and a baker to create an entity and accesses it via SystemAPI.GetSingletonEntity<>();

In order to make sure the singleton entity already exists he calls state.RequireForUpdate();
So far so good, but he accesses the entity in the update function. I intended to access during OnCreate() as i need to initialize some things that already require this component before OnUptate().
So i’ve spent a while searching for any ways to make sure a system is only initialized after the baker stuff happens but no luck. Should I instead seperate the systems into one init system and one update system, where the init system actual initializes in onupdate() and afterwards disables itself? They are working on the same components

On a similar note i am curious about the overhead of calling SystemAPI.GetSingletonEntity<>(); ever frame rather than caching it in the system or something? My general mistake might be to want to cache the component data relevant to the system within the system instead of calling SystemAPI.GetSingletonEntity<>(); every frame. But it strikes me as so counterintuitive if i use the same few variables each frame that i would go out of my way to grab them from a different component?

If I am completely off somewhere in my approach to learning ecs please let me know, thankful for any pointers

You would typically use OnStartRunning/OnStopRunning for this.

1 Like

I was about to return and say that chatgpt finally managed to give me this solution as well (after a little more back and forth rephrasing among which i at some point swapped to systembase) however from what i can tell that requires extending SystemBase rather than iSystem?

There’s ISystemStartStop which you extend along with ISystem.

1 Like

thanks a bunch :slight_smile: