Creating a wall with a bend and applying a texture

I’m a developer and somewhat new to Unity and 3D modeling in general. I’m working on a project where I need to dynamically create a 3D model based on data in a database.

I’m creating a wall, which I did using a Quad mesh filter. However, this wall has a 90 degree angle in it. I also need to apply a single texture to this entire wall.

I have some code in there that breaks the wall into two parts and renders the correct part of the texture to each piece of the wall. However, it would be much easier if I could create that wall as one object and just apply the complete texture to it. Any idea how this can be done? Thanks.

The process of determining which part of a texture is applied to which bit of a model is called “UV mapping” (since it uses 2d coordinates commonly referred to as u and v). See @robertbu’s answer in this thread as to how you can assign uv coordinates to dynamically generated meshes: