Can I snap a game object to the face of another similar to vertex snapping?

Say I have a cube in the scene, and I create a child empty game object for it. I can use Vertex Snapping to snap the empty game object to any of the 8 vertexes of the cube, but I want to be able to snap the game object to any of the midpoints of the edges or midpoints of the faces as well, and also the center of the cube, giving 27 options instead of 8. Is this possible? Thanks!

You’d need to write a custom editor script to be able to do that for a primitive cube, ie. 8 vertices.

A workaround solution would be to use 8 smaller child cubes under your parent cube. You could then use the child cube meshes for vertex snapping only, and the parent cube for rendering/colliders etc.

Have a look at the Mesh class which states that it can create and modify meshes. If I’m correct, you should be able to calculate the points of a face and subdivide it to get those extra vertices. Though I’d warn you that this can take a toll on performance.

Alternatively you could write a MonoBehvariour script which utilizes the [ExecuteInEditMode] attribute (which does what the name implies, of course). In the script you could perhaps cast a ray onto the face of an object and get a point on the face of the object to snap to. This requires the object to have a a collider, which isn’t ideal.

All this vague, but I hope it helps.