We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
private string path = "Assets/Resources/Model"; private void OnPreprocessModel() { ModelImporter modelim = assetImporter as ModelImporter; if (modelim == null) return; //model目录下带动作的fbx不要导入材质 if (assetPath.Contains(path)) { if (modelim.importAnimation && modelim.clipAnimations.Length > 0 && modelim.importMaterials) { modelim.importMaterials = false; } } }
private void OnAssignMaterialModel(Material material, Renderer renderer) { //提示材质有问题的fbx if (material.mainTexture == null) { ModelImporter modelim = assetImporter as ModelImporter; if (modelim != null && modelim.importMaterials == true) { EditorUtility.DisplayDialog("fbx材质问题", "模型:" + assetPath + "的材质mainTexture是空!请检查模型", "ok"); } } }
导入其他资源也同理。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
资源管理是Unity开发者经常遇到的问题,比如在导入模型(fbx)资源时,对于一些不需要材质的纯动作模型,如果美术没有取消勾选Import Materials选项(如下图),就会增加包中的无用材质和贴图,造成空间浪费。
如果单纯靠人工每个模型检查设置,无疑既增加了成本,也为疏漏创造了条件。因此本文提供一种自动核查的方式处理模型资源导入的管理。
要实现资源导入核查需要获取Unity导入资源时的回调入口,这里需要介绍一下AssetPostprocessor 类。该类是Unity大部分资源(模型、图片、声音)导入时调用的处理类。有导入之前、导入之后等时间节点的处理函数。具体介绍可以查看api(https://docs.unity3d.com/ScriptReference/AssetPostprocessor.html)。
导入其他资源也同理。
The text was updated successfully, but these errors were encountered: