Search Unity

Multiple materials on one mesh(c#)

Discussion in 'Scripting' started by Abatuf, Mar 27, 2015.

  1. Abatuf

    Abatuf

    Joined:
    Jan 9, 2014
    Posts:
    18
    Hi!
    I am beginner unity programmer and i have a question about meshes created runtime - how do i, in bounds of one mesh(MeshFilter.mesh) can assign multiple materials to different faces?
    Reason why i am asking how to do this in single mesh is here:



    As you can see i have (obvious minecraft clone thingy, just interest and experience) huge amount of geometry, all this generated runtime and i need to render this fast. So i have smaller chunks of geometry(one chunk is 64x64x32), and each one is one big mesh(so unity can batch it pretty good). But how can i assign different materials to different faces?

    Thanks!
     
  2. Abatuf

    Abatuf

    Joined:
    Jan 9, 2014
    Posts:
    18
    Found answer ;)
     
  3. mtnwolf777

    mtnwolf777

    Joined:
    Jul 3, 2015
    Posts:
    1
    What was the solution?