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() { } }
标签:prefabs,C#,模型,System,生成,Start,frame,using,image From: https://www.cnblogs.com/bazi/p/17153733.html