void GeneratePreview(Item item, bool isReCreate = true) { if (item == null || item.prefab == null) { return; } { string preview_path = Configure.ResAssetsPath + "/Preview/" + item.prefab.name + ".png"; if (!isReCreate && File.Exists(preview_path)) { Texture texture = UIEditorHelper.LoadTextureInLocal(preview_path); item.tex = texture; } else { Texture Tex = UIEditorHelper.GetAssetPreview(item.prefab); if (Tex != null) { DestroyTexture(item); item.tex = Tex; UIEditorHelper.SaveTextureToPNG(Tex, preview_path); } } item.dynamicTex = false; return; } }
void GeneratePreview(Item item, UISnapshotPoint point) { if (item == null || item.prefab == null) { return; } { string preview_path = Application.dataPath + "/" + Configure.ResPath + "Preview/" + item.prefab.name + ".png"; if (File.Exists(preview_path)) { Texture texture = UIEditorHelper.LoadTextureInLocal(preview_path); item.tex = texture; } else { Texture Tex = UIEditorHelper.GetAssetPreview(item.prefab); if (Tex != null) { DestroyTexture(item); item.tex = Tex; UIEditorHelper.SaveTextureToPNG(Tex, preview_path); } } item.dynamicTex = false; return; } }