C#根据模型生成图片
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; public class ExportPng : MonoBehaviour { 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()); } } // Update is called once per frame void Update() { } }