- Home /
OnMouseUp not always firing on mesh that is changing
Got a situation where a runtime-built mesh is changing based on user input: the user drags the mouse over the mesh, and based on where they move it we move the verts around and rebuilding the mesh frame-by-frame. The mesh change occurs only when during a mouse drag. What we're seeing is that the mesh will detect and fire an OnMouseDown and OnMouseDrag callback when the user begins their motion, but won't always register an OnMouseUp when they release.
I've debugged some and found that if you drag the mouse into a fresh, unchanged area of the mesh, the OnMouseUp callback will not happen. But, if you drag around in a previously modified area of the mesh, it will occur. It seems to be that if the mouse is released over a part of the mesh that was changed during that drag sequence, OnMouseUp simply does not occur.
Any ideas?
What type of collider are you using? Primitive or mesh? If it works on un-changed sections of the mesh but not on modified sections, I dare say it has nothing to do with the mouse up function. Go through the game frame by frame and see if your collider is being updated with the changes. $$anonymous$$y guess is that it is not updating. Try calling recalculateBounds on the new mesh.