#Error with ComponentLookup

1 messages · Page 1 of 1 (latest)

nocturne condor
#

Sometimes I get this error when I do a component lookup. Why does it happen, and how do I avoid it?
This is how I get the lookup SystemAPI.GetComponentLookup<MultiplayerComponent>(true); And the error is thrown in a SystemBase on this line of code if (!SystemAPI.GetComponentLookup<MultiplayerComponent>(true).TryGetComponent(entity, out MultiplayerComponent multiplayerComponent))

...```

btw, the MultiplayerSystem is a SystemBase that uses Entities.ForEach to write to the MultiplayerComponent.
Any ideas?
gloomy fractal
#

jobify code that throws
or
if you want to access lookup in main thread - do it before any other jobs scheduled (create new group right after beginecb)

nocturne condor
#

The lookup is in a different system. The job is in another system.

#

I'll try the UpdateAfter tag

#

didn't work

warm frigate
nocturne condor
#

That worked! Thanks!

#

But I use component lookup a lot while having the component being written to in a job on another(its main) system.
Why don't those ones throw a dependency error? What's so special about this one?

fluid parcel
#

Luck