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

Question Problem with submeshes

Discussion in 'Scripting' started by TTuPC, May 6, 2022.

  1. TTuPC

    TTuPC

    Joined:
    Mar 22, 2021
    Posts:
    36
    I have a mesh.
    I split this mesh in multiple meshes along the Z axis.
    The problem is that when I split a mesh with multiples materials the new meshes show only the first material (and the others are ignored), and I receive this warning on the inspector:
    upload_2022-5-6_12-49-14.png

    With a very huge drop of frame rate.
    Someone can tell me what I should do?
     
  2. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,528
    Well, the error clearly tells you that you have more materials than submeshes. We can see that you have 17 materials. Are you sure your mesh has exactly 17 submeshes in total?
     
  3. TTuPC

    TTuPC

    Joined:
    Mar 22, 2021
    Posts:
    36
    Every mesh has 1 submesh, but what should I do?
     
  4. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,528
    Well, when you split the submeshes into individual objects where each object has one of the submeshes, then each of those object needs exactly one material. Which one? Well, those which corresponded to the original submesh. The material list and the submeshes have a 1-to-1 relationship. So submesh 5 will use material 5.
     
  5. TTuPC

    TTuPC

    Joined:
    Mar 22, 2021
    Posts:
    36
    When I split my mesh I create various meshes that can use multiples materials of the original one, and how can I add submeshes?
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,757