#[DisableAutoCreation] quirks

1 messages · Page 1 of 1 (latest)

tough veldt
#

Hello!

I have a GameMode system to support multiple gamemodes, knowing this, not all systems should be auto created for worlds (Because I may share common tag components that systems might operate on, I don't think ignoring them is safe, correct me if there is a better way)

So I create systems based on their gamemode. A little quirk I find annoying and probably bug prone is that, from what I can see, I have to manually add systems to their group after manual creation instead of it using the defined class attributes

Example:

var localHandle = world.CreateSystem<LocalPlayerSetupSystem>();
world.GetExistingSystemManaged<SimulationSystemGroup>().AddSystemToUpdateList(localHandle);

var cinemachineHandle = world.CreateSystem<CinemachineCameraSystem>();
world.GetExistingSystemManaged<TransformSystemGroup>().AddSystemToUpdateList(cinemachineHandle);

var firstPersonHandle = world.CreateSystem<FirstPersonCameraSystem>();
world.GetExistingSystemManaged<LateSimulationSystemGroup>().AddSystemToUpdateList(firstPersonHandle);

This is mostly just annoying. Its more convenient to use the class attributes, like UpdateAfter, UpdateInGroup. But it seems like manual creation does not add these to their group.

I was wondering if there was a good way to have systems auto attach to their groups defined in their attributes even when manually creating them.

If not, worse case I can just use reflection and have some extension method, but was wondering if ECS package has some way to do this.

Thanks!