Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

SetTriangles Method for Multiple Materials on Procedural Mesh

Discussion in 'General Graphics' started by devstudent14, Dec 6, 2019.

  1. devstudent14

    devstudent14

    Joined:
    Feb 18, 2014
    Posts:
    133
    Hello,

    I'm making a procedural mesh, and I currently don't know how to apply multiple materials to that mesh.

    I looked online, a few very brief forum posts mentioned using mesh.SetTriangles().

    I haven't seen an implementation of this yet, so I'm a little confused as to how to actually use this method.

    So far I'm getting bad results!

    In the attached image, I broke up my triangles array which was an array of ints. I then set triangles for each part of the mesh I wanted governed by a different material.

    No luck so far. Any tips greatly appreciated.
     

    Attached Files:

  2. mexicano

    mexicano

    Joined:
    Nov 12, 2013
    Posts:
    23