Missing SharedComponentDataFromEntity?

I can’t seem to find a way of looking up a sharedcomponent data from an entity in one of my systems.

Am I missing something?

EntityManager.GetSharedComponentData(entity);

1 Like

Oh, I thought it was meant to be injected the same way ComponentData is injected.
Thanks!

Yes, unfortunately this is missing. EntityManager.GetSharedComponentData will not work from within a Job.

A patch adding it to JobComponentSystem is attached. I did not add injection code as I didn’t need it.
Sample usage:

var someJob = new SomeJob
{
    mesh = GetSharedComponentDataFromEntity<MeshInstanceRenderer>(),
};

3603190–292631–SharedComponentDataFromEntity.zip (1.44 KB)

@Joachim_Ante_1 Will this feature ever be included in the official ECS library?
Is there a specific reason why we can’t use SharedComponentData within jobs?

Is there a specific reason why we can’t use SharedComponentData within jobs?
Because shared components are managed types and we don’t support managed types (classes) in Burst. At some point we will need to introduce value type (struct) shared components than can be accessed.