Im going to try and put this as simply as possible
I have an Entity, with Component PrefabHolder that I have placed in the Entities Subscene (<- is that of importance?)
Then, in OnCreate in a System, I have this code, which first does a standalone entity query to determine the amount of PrefabHolders there are, and then actually iterates over them (the one there should be) to get it's prefab. However the query finds 0 and therefore the foreach gets skipped too. I'm trying to figure out why the queries simply dont know about the PrefabHolder's existence. The two suspicions I have: Could it have anything to do with the prefabholder being in a SubScene? And, Could it have anything to do with the sytem being ran with [CreateAfter(typeof(BeginSimulationEntityCommandBufferSystem))]?
Any help is appreciated, I feel like I've run into a dead end.
//get prefab holder entity
Entity facePrefab;
facePrefab = Entity.Null;
EntityQuery prefabHolderQuery = new EntityQueryBuilder(Allocator.Temp).WithAll<PrefabHolder>().Build(ref state);
int phCount = prefabHolderQuery.CalculateEntityCount();
Debug.Log($"Found {phCount} prefab holders"); //to count how many prefab holders there are
foreach (RefRO<PrefabHolder> ph in SystemAPI.Query<RefRO<PrefabHolder>>()) //there should always be one of these
{
Debug.Log("Found prefab holder"); //but this never gets called
facePrefab = ph.ValueRO.facePrefab;
}