Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

ModelImporter.SearchAndRemapMaterials not working as expected

Discussion in 'Formats & External Tools' started by gbastos_hia, Dec 10, 2020.

  1. gbastos_hia

    gbastos_hia

    Joined:
    Aug 4, 2020
    Posts:
    19
    Here's a doozy.

    I've been working on an FBX importer for our models in order to automate some of the process and I've come across an issue that I can't seem to solve.

    Basically, part of the import process is to (potentially) extract materials from the FBX and then search and remap the model's materials.

    When first extracting the materials, the call to search and remap seems to work just fine and the imported model is setup as expected.

    However, when updating an existing model for which materials have already been extracted (we don't want to override those as someone might have changed them), we don't extract the materials and simply call search and remap. Upon completion of the import, the correct materials have been assigned to the remapped materials list, but it seems the skinned mesh renderers still point to the original materials.

    I should note that the extraction and remapping of materials is done in
    OnPostprocessAllAssets


    Any ideas on what I might be doing wrong?
     
unityunity