It seems that a JobComponentSystem doesn’t execute right away. I tried using UpdateBefore but it doesn’t work.
[UpdateBefore(typeof(SystemB))]
class SystemA : JobComponentSystem {
...
}
class SystemB : ComponentSystem {
protected override void OnUpdate() {
// While debugging, I saw that the data was not yet updated in SystemA
}
}
Because systems without injection - disabled. Systems are automatically disabled when all ComponentGroups have zero entities. [AlwaysUpdateSystem] can be used to always force update a system.
Actually system with no injection equals to AlwaysUpdateSystem! (excerpt from ComponentSystemBase)
But with one or more injection defined, if it has zero entity coming then it is automatically disabled. This is correct.
public bool ShouldRunSystem()
{
if (m_AlwaysUpdateSystem)
return true;
var length = m_ComponentGroups?.Length ?? 0;
if (length == 0)
return true;
// If all the groups are empty, skip it.
// (There’s no way to know what they key value is without other markup)
for (int i = 0;i != length;i++)
{
if (!m_ComponentGroups[i].IsEmptyIgnoreFilter)
return true;
}
return false;
}
Ok English is difficult… op if you are confused my “injection” meant the presence of [Inject] tag or any first time use of a unique GetComponentGroup but @eizenhorn 's “injection” meant the amount of entities that is coming in as a result of those injection.
Injection defined : 0 → Always update
Injection defined : 1+ / Entities injected : 0 → Does not update
I’ll see if there were no entities injected to SystemA. I’m transforming a ComponentSystem into a JobComponentSystem. The ComponentSystem version works and I didn’t change the injected data.