Hi, (this is identical to github’s answer, posting here in case if anyone else might need it):
If you’re using system to alter state, simplest solution would be to add actual MonoBehaviour to the entity.
And then use system to notify the behaviour. Also, make sure to put managed system into AfterSimulationGroup to avoid job stalls.
-
Depending on whether its IEntityManagedSupplier or IEntitySupplier, you can do add it in SetupEntity:
entityManager.Add(entity, this)
[equivalent to EntityManager.AddComponentObject(entity, UnityEngine.Object)]
or via
_entityBehaviour.Add(this)
-
Add tag component to the entity by any means;
-
Then via managed [SystemBase] system you can query that component directly and do whatever needed.
E.g. via EFE:
Entities.ForEach((in SomeBehaviour behaviour) => behaviour.DoSomething()
.WithAll<HitComponent>()
.WithStructuralChanges() // Probably will be required if you're altering Entity state via DoSomething
.WithoutBurst()
.Run();
Also, I’ve kinda forgot to update this thread for a while.
Latest version is 1.0.5, mostly API consistency changes & minor bugfixes to the editor.