public GameObject[] prefabs;
// Start is called before the first frame update
void Start()
{
for (int i = 0; i < prefabs.Length; i++)
{
EditorUtility.SetDirty(prefabs[i]);
Texture2D image = AssetPreview.GetAssetPreview(prefabs[i]);
System.IO.File.WriteAllBytes(Application.dataPath + "/Resources/Image/image_" + i + ".png", image.EncodeToPNG());
}
}
把要预览的模型放到拖拽实例到数组里,然后随便挂一个空物体运行,运行完之后右键Refresh刷新一下界面就出来了,路径要写对