How could I cut a mesh into two pieces with code?

I want to do something that seems to be simple but is proving difficult to find an answer to. All I want is to be able to cut a cylinder mesh straight into two pieces dynamically in real time using code. The cut does not have to be diagonal or anything, I just want it to be a straight cut at the point where the mouse is on the object. I know that there are a lot of assets out there for cutting objects but they are all very complicated and kind of overkill for what i want to do, because I don’t require any weird angled cuts, and i also don’t want a system like fruit ninja where you drag the mouse to determine the cut. I just want to be able to have a cylinder mesh in my game and click on it with my mouse on certain spots and have it cut straight in half at those locations. This is hard to word and I hope somebody can help me out, because I am just at a loss of where to start with the code.


I think it will be easiest if you create two chopped model in 3d editor and then replace the original cylinder with them.

Otherwise you will have to do lots of calculation to cut a 3d model to two. Have you written any script to modify mesh? First you have to separate the mesh’s vertices into two arrays. Then you have to create the two triangle arrays depending on the original mesh and those new vertices arrays.

Or you can buy plug-in in unity asset store