运行或者打包时候报错:This MeshCollider requires the mesh to be marked as readable in order to be usable with the given transform.
解决方法:开启Meshes的读写
可以写一个批量处理的脚本:
using UnityEngine;
using UnityEditor;
using System.IO;
public class FixModel
{
[MenuItem("Tools/FixModel")]
static void Fix()
{
var fs = Directory.GetFiles(Application.dataPath, "*.FBX", SearchOption.AllDirectories);
foreach(var f in fs)
{
var path = f.Replace(Application.dataPath, "Assets");
var imp = AssetImporter.GetAtPath(path) as ModelImporter;
if(null == imp)
{
Debug.LogError(Path.GetFileName(f) + " is not a Model");
}
else
{
if(!imp.isReadable)
{
imp.isReadable = true;
Debug.Log("fix " + path);
imp.SaveAndReimport();
}
}
}
AssetDatabase.Refresh();
}
}