mesh generation in unity

I don’t know if this is considered mesh generation but it may be.

So, lets say i have a tower, tower a. Now lets say theres a towe r b. What i ould want to do is generate a"wall" from tower a’s position to tower b’s position. I don’t think i could do it by scaling because im going to have it textured so if i scale so does the texture. So like. If i put two towers at any position and are at any angle at any distance away from each other i could make or generate a wall from point a to point b and have it textured. Thats basically what i want. Would any one know how to get that?

Assuming your wall segments are nice and small (i.e. you would never need to cut one in half to make it fit between the towers) this is actually very simple to do.

You can build an array of CombineInstances and set the transform matrix on each such that the segments are arranged in a straight line. You then turn your CombineInstance array into a Mesh via Mesh.CombineMeshes.

Assuming your geometry isn’t too dense, this is a pretty fast operation, and will save you a ton of drawcalls.