I made a simple (but effective) solution for selecting entities in the Unity SceneView.
The goal was to make it as simple to install as possible, so it’s become a package.
You can find all info here: GitHub - JonasDeM/EntitySelection: A minimal solution for selecting entities in the unity sceneview. Useful for users using older versions of the Unity entities package.
Until we get official entity picking, this might be usefull for people working with DOTS.
Feel free to post feedback.
Cheers
17 Likes
Enzi
October 13, 2019, 4:07am
2
Awesome man! Thanks for sharing.
I haven’t tested but looks neat
Small update,
Improved “How to select” in the readme.
Added a green wirecube gizmo around selection.
2 Likes
jdtec
January 13, 2020, 3:24pm
5
Would be really nice to see this functionality have official support soon. And the ability to see DOTs physics colliders at runtime!
If I understand you correctly, you can have that already:
// Physics debug system.
var entity = entityManager.CreateEntity();
entityManager.SetName(entity, "PhysicsDebugDisplayData");
entityManager.AddComponentData<PhysicsDebugDisplayData>(entity, new PhysicsDebugDisplayData()
{
DrawBroadphase = 0,
DrawColliders = 1,
DrawColliderAabbs = 1,
DrawColliderEdges = 1
});
So, just create an entity once with the above component (can be configured differently, of course).
2 Likes
Version 0.2.0 is out!
Massive performance/memory improvements by using MaterialPropertyBlocks.
Removed all non editor classes. (This required increasing the min unity version to 2019.3)
2019.2 is still supported by a new 2019.2 branch (See Readme), but there’s no WireCube to indicate selection.
1 Like
florianhanke:
If I understand you correctly, you can have that already:
// Physics debug system.
var entity = entityManager.CreateEntity();
entityManager.SetName(entity, "PhysicsDebugDisplayData");
entityManager.AddComponentData<PhysicsDebugDisplayData>(entity, new PhysicsDebugDisplayData()
{
DrawBroadphase = 0,
DrawColliders = 1,
DrawColliderAabbs = 1,
DrawColliderEdges = 1
});
So, just create an entity once with the above component (can be configured differently, of course).
Hi
Is it normal that this works only displaying one collider and not more ?
Thanks a lot
Jonas_DM:
Version 0.2.0 is out!
Massive performance/memory improvements by using MaterialPropertyBlocks.
Removed all non editor classes. (This required increasing the min unity version to 2019.3)
2019.2 is still supported by a new 2019.2 branch (See Readme), but there’s no WireCube to indicate selection.
Great job !
Does it require some component for it to work? Like what if I’m using DrawMeshInstanced() so entities don’t have any bounding box information.
tertle
July 22, 2020, 10:41am
11
I call this trick pixel perfect picking based off this post from 2017 where I first saw it: https://medium.com/@philippchristoph/pixel-perfect-selection-using-shaders-16070d3094d
But to answer your question the implementation in this post requires RenderMesh and LocalToWorld. However if you implement the technique yourself you can do it with whatever components you use, it just fills a CommandBuffer with mesh data.
The idea is just to basically render the scene again giving every mesh a custom flat material with a different color. Then you simply query the color of the pixel your cursor under and you check which mesh that is.
3 Likes