Extending SystemBase allowing Scheduled/Parallel Foreach Lambda to use

So I’m in the situation where I would like to extend systemBase so that the codes in my Entities.ForEach.Schdule/Parallel can use it.

I tried to add those in a inherited class as typical c# methods. But codes in the schduled jobs are complaining passing in reference. I wonder why does it allow methods from SystemBase (E.g.) HasComponent, GetComponent etc. but wouldn’t allow using of my custom methods?

Is there any recommand ways of extending the SystemBase? Would be lovely if somebody could point me to the right link to look into if that is indeed possible.

Thanks in advanced!

Unity’s custom methods get processed by source gen. Unfortunately, you can’t do the same. You are best off making a utility struct that has the member functions you want. Then create an instance locally and let the lambda capture it.

There are examples here (action base systems). It’s not using Entities.ForEach(), though.