#RequireForUpdate<T>() gone wrong.

1 messages · Page 1 of 1 (latest)

teal mountain
#

Why my OnUpdate() keep Running even when there is no more NewlySpawned Component exist??
To Prove it: In debug console:

  • "Found NewlySpawned." x 2
  • "Updating" x infinite

System purpose: Any new Entity (that has NewlySpawned component Enabled) will have its position set (being set in SetPosJob), I want to stop OnUpdate() Running when no NewlySpawned component (or Query<NewlySpawned> return nothing).

Thanks for reading.

jovial merlin
#

Enable state is not a consideration for RequireForUpdate

#

RequireForUpdate does an IsEmpty**IgnoreFilter**

#

to check if the system should run

#

so filters (change, order, shared and enabled) state is ignored

sullen obsidian
#

@teal mountain Hi have you find a work a round for this?

teal mountain
sullen obsidian
proper bear
#

checking whether components are enabled is a little expensive since it requires iterating

#

if you have logic that depends on this ideally you do this yourself and schedule the work appropriately

#

if you really insist you could do it in a managed system and override ShouldRunSystem()

#

at least I think you can override it, I never used it 🤔