Is there anything like Debug.Log() for entities inside the foreach loop?
I have a foreach with a query and trying to figure out which entities are being included in the SystemAPI.Query(). However, Debug.Log() only prints out the entities which had the components added during the bake time.
If I add PeriodicFixedTimerData component during the runtime, the debug print doesn’t print this entity out,. Nonetheless the component data itself gets updated.
If I add Debug.Log("entity: " + entity) above the if() statement, it only ever prints out entities which had this component added during the bake step.
That means that it is only the baked entities that the query is finding. Nothing special about Debug.Log here. It is providing a clue to whatever problem you are facing.
As mentioned above, you job process only what queries matches.
So if your entity doesn’t have required components, or is marked as prefab, it will not be processed in the job. Hence debug.log will not be called.
Maybe this is the problem part? It’s normal that the foreach only works for entities with the specified component. It should also automatically include any entities you create at runtime.
My silly mistake. return from foreach() is actually return from the function itself (what I needed was continue)… Should stop writing code after midnight :facepalm: