How to determine if system is derived from a custom base.

I want to iterate over all systems in a group and if it is derived from a custom base, check public properties of that base.

What I have:

foreach(ComponentSystemGroup group in ecoSimSystemGroup.Systems) {
    foreach(ComponentSystemBase system in group.Systems) {
        // ??
    }
}

IsAssignableFrom and IsSubclassOf don’t seem to work.

if (system is YourBaseSystem yourBaseSystem)
{
 
}

should work I think?

1 Like

I think I only had a logical error, group.Systems only returns systems that are immediate children and not all children like I expected. The system I’m looking for is deeper in the tree.

Is there an easy way to get all children or do I have to roll my own recursive solution?

World.DefaultGameObjectInjectionWorld.Systems works to get all systems, not sure why ComponentSystemGroup wouldn’t work the same way though.

The Systems property on the group is expected to only returns the systems that belongs to that group. A more reliable way to get the World’s systems is World.Systems (World is a property that points to the system’s world)