I’m using [ReadOnly] public ArchetypeChunkSharedComponentType<GoalContainer> GoalContainerType; to get shared component data in an IJobChunk BUT the api chunk.GetSharedComponentData<GoalContainer>(GoalContainerType, ENTITYMANAGER]); want’s an entitymanager as an argument. Am i missing something?
So far you can’t access ISharedComponentData inside jobs. It has been said here in the forum that it will be supported in the near future, but I don’t know when.
thanks. that’s really surprising though. I thought I saw some IJobParallelForFilter… or something along those lines and i assumed it was for filtering by shared component data. This throws a wrench in my plans… Is the workaround just to use ComponentSystem on the main thread or is there a method to pull the data off in OnUpdate and pass it into the job?
yes you can pass it into the job. check also here on forum, forgot the exact api… getallsharedcomponentdata or something
SCD’s real value is kept in a managed list in EM that’s why the API wants you to provide the EM, so SCD index on each chunk could be exchaged for the value. And managed list along with EM is a reference type and cannot go into a job. I have an article about this too if you want to read something : https://gametorrahod.com/everything-about-isharedcomponentdata/ The ACSCT is still good for doing chunk.Has or .DidChange in-job.
Your blog is a goldmine. Do you have a patreon?