#Access Visual Effect (Managed Components) from IJobEntity

1 messages · Page 1 of 1 (latest)

tight compass
#

How do I access managed components like Visual Effect from IJobEntity? I am trying to port Entities.Foreach to IJobEntity to be compatible for an Entities 1.0 upgrade.
I know I can access it as part of the execute method signature but ho can I do random access?
Is there anything like ManagedComponentDataFromEntity

nocturne ember
#

There's no such construct as ManagedComponentDataFromEntity - That said, it's valid to make your own. Key rule of jobs. Static values can access managed data! - Keep in mind it sways away all Burstability and .Schedule/.ScheduleParallel + it didn't check how safe the static call is 😅
You could e.g. make a ManagedStore.GetData<TType>(Entity); Which is a m_MyStaticEntityManager.GetComponentObject<TType>(entity).
Just make sure the user set up the container correctly before running e.g. ManagedStore.Init(ref state) could be m_MyStaticEntityManager = state.EntityManager.

For more detail on Managed IJobEntity: https://forum.unity.com/threads/new-version-of-entities-1-0-pre-release-now-available-march-2023.1415658/#post-8898567