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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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?