materialFolderPath | The path to search for matching materials. |
bool Returns true if any materials have been remapped, otherwise false.
搜索项目中是否存在匹配的材质,然后使用这些材质而不是内部材质。
Unity follows specific naming conventions when importing SpeedTree materials. This allows Unity to search for matching material assets by name.
The materialFolderPath is relative to the project folder, for example "Assets/MyModel Materials".
Throws ArgumentNullException when the path is null and ArgumentException when the file path is empty.
using UnityEditor;
public class MaterialRemapper : AssetPostprocessor { void OnPreprocessModel() { var importer = assetImporter as SpeedTreeImporter; importer.SearchAndRemapMaterials(importer.materialFolderPath); } }