Solved. See Edit 3 if you have a similar issue.
Hi, I can’t get the Physics Debug Display component to work in my project at runtime. It works in a new project using the exact same Editor version (6000.0.23f1), but not in my existing project.
In the new project, I altered the sample scene by renaming it, and I added a subscene containing an empty object with the Physics Debug Display, and I added a cube for it to display the collider of:
This works. Since I can’t get it working in my existing project, I tried exporting this scene, and it still won’t work in my project at runtime (it displays the green collider only outside of Play mode).
I noticed that the gizmos are controlled by the PhysicsDebugDisplaySystem:
This gizmo is only available in the new project - it does not show in my existing project. I assume this system is not running in my existing project, but I cannot find any guidance on why this issue may occur or how to handle it, or why it would render in Edit mode but not in Play mode.
Both projects are using Entities 1.3.8 and Unity Physics 1.3.8.
This is my first time using ECS - I’m trying to integrate an ECS system with my own data-oriented systems so that I can pass colliders to Unity Physics for raycasting. I need to visualize these colliders to verify that I have passed them to Unity Physics correctly. Currently I’m working on testing them with a wall of raycasts but I’d still like to have this debug display available for other tests.
Anyone know what I can try here?
More info:
URP. Tried Forward+ and Deferred.
EDIT 1: The issue with the existing project is deeper, because nothing in subscenes renders at all. Entities Graphics 1.4.5 is installed. Subscenes, closed, do render in Edit mode - but objects disappear as soon as Play mode is entered. The subscene is marked to AutoLoad. In the new project, the closed subscene automatically loads and the entities render. I assume there is some issue with the core ECS systems not actually running.
EDIT 2: In the existing project, the subscene AutoLoad does not work - the scene remains closed.
EDIT 3 (+ solution): The issue was caused by a custom system which invoked ‘EntityManager.DestroyEntity(entityQuery)’, which did more than I expected it to. For testing purposes I was using this to clean the state between updates. I also did not expect the system to be running. I was testing this in a new scene, but ECS seems to just run all systems that it can find in the project (I was using a custom bootstrapper to control for this but removed it whilst testing this issue).
It seems that destroying entities in this way either prevented the scene from loading, or destroyed it; probably because I misunderstood the query.
I still don’t see PhysicsDebugDisplaySystem in my gizmos list, but it does work ¯\(ツ)/¯