Hello, I’m trying to render entities that have meshes which are being created at runtime. This is now working fine in the “game” viewport/camera, however the editor scene view camera does not render these Entities. Is this just not supported and converted/baked entities still just use the GO renderer, or is there something I might be missing?
This is what it looks like in the editor (see the plane for a position reference, I am looking at the correct position).
Using Entity Graphics 1.0.0-pre.44 with unity 2022.2.6f1
So in case anyone else runs into this issue: It seems like the EntitiesGraphicsSystem just does not draw to the inspector, but only in the game viewport. If I understand this correctly the editor viewport is always drawing just the gameobjects, whether in edit or at runtime. To solve this issue I created a small system that does the job (with suboptimal performance, but it does work):
[UpdateInGroup(typeof(PresentationSystemGroup))]
[WorldSystemFilter(WorldSystemFilterFlags.Default | WorldSystemFilterFlags.Editor)]
public partial class EditorDrawingSystem : SystemBase {
protected override void OnUpdate() {
var hybridRenderer = World.GetOrCreateSystemManaged<EntitiesGraphicsSystem>();
var sceneView = SceneView.lastActiveSceneView;
Entities.WithoutBurst().WithAll<YourComponentHere>().WithNone<DisableRendering>().ForEach((in LocalToWorld localToWorld, in MaterialMeshInfo renderDesc) => {
var mesh = hybridRenderer.GetMesh(renderDesc.MeshID);
var material = hybridRenderer.GetMaterial(renderDesc.MaterialID);
Graphics.DrawMesh(mesh, localToWorld.Position, localToWorld.Rotation, material, 0, sceneView.camera);
}).Run();
}
}