I’m trying the MeshEditorScene under “Assets/Samples/ProBuilder/4.4.0/Runtime Examples/Runtime Editing”.
-
I extrude the top face of the cube to make it higher.
-
When I hover mouse over the top face, it is no longer highlighted. And I cannot extrude this top face again.

-
It looks like this is caused by collider not being updated after the mesh has changed.
-
So I added code in MeshEditor.cs (Line 20 to 23) to “refresh” the collider. After this change, when I hover the mouse over the top face, it is highlighted and can be extruded again.
void UpdateDrag()
{
var distance = GetDragDistance() - m_DragState.offset;
var mesh = m_Selection.mesh;
var indices = m_DragState.meshState.indices;
var vertices = m_DragState.meshState.vertices;
var origins = m_DragState.meshState.origins;
// Constraint is in world coordinates, but we need model space when applying changes to mesh values.
var direction = mesh.transform.InverseTransformDirection(m_DragState.constraint.direction);
for (int i = 0, c = indices.Count; i < c; i++)
vertices[indices[i]] = origins[i] + direction * distance;
mesh.positions = vertices;
mesh.ToMesh();
mesh.Refresh();
//======= "Refresh" collider =======
var col = mesh.GetComponent<Collider>();
col.enabled = false;
col.enabled = true;
}
Question:
Is this how it’s supposed to behave? Do I really need to disable and enable the collider to make it work?
Environment:
- Unity 2019.4.13f1
- ProBuilder 4.4.0