using UnityEditor; using UnityEngine; /// <summary> /// 将预制体转个图片出来 /// </summary> public class ExportPicture : 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/Images/YIFU_" + i + ".png", image.EncodeToPNG());//存入位置 } } }
标签:prefabs,image,Start,体转个,预制,public,图片 From: https://www.cnblogs.com/z816/p/17191877.html