In an isystem. I want to enable the WalkToLobby
component. This component may or may not be enbled currently. So I use WithOptions(EntityQueryOptions.IncludeDisabledEntities)
instead of withdisabled<WalkToLobby>()
. But the query excludes entities with walkToLobby
disabled.
To debug, I tried to remove the EnabledRefRW<WalkToLobby>>()
. Those excluded entities were then included.
Is there any thing wrong with my understanding about the option?
void SpawnPeople(ref SystemState state)
{
var quests = SystemAPI.GetComponentRO<SpawnQuests>(msn);
foreach (var (people, inPool, walkToLobby) in SystemAPI.
Query<RefRW<People>, EnabledRefRW<InPool>, EnabledRefRW<WalkToLobby>>()
.WithOptions(EntityQueryOptions.IncludeDisabledEntities)
.WithAll<InPool>())
{
if (!quests.ValueRO.value.TryDequeue(out var massing)) return;
inPool.ValueRW = false;
walkToLobby.ValueRW = true;
people.ValueRW.massing = massing;
people.ValueRW.building = SystemAPI.GetComponentRO<Massing>(massing).ValueRO.host;
}
}