Remove FBX from default resource reference

Sometimes when you import fbx, you don’t need to create material, you set importMaterials to false, and if you hit AssetBundle on fbx, you’ll get Default-Material and Stander 1Getting into the bag, resulting in resource redundancy.

Solution: add the following code to AssetPostprocessor:

    public Material OnAssignMaterialModel(Material m,Renderer r)
    {
        var importer = assetImporter as ModelImporter;
        if(importer != null && importer.importMaterials == false)
        {
            return CommonMaterial; //A material resource stored locally}return null;
    }

 All reimport FBX files are required.

Leave a Reply

Your email address will not be published. Required fields are marked *