MoTaForPSVita/Assets/PrefabsToLow.cs
2024-04-30 17:39:50 +08:00

46 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//using UnityEngine;
//using System.IO;
//using System;
//public class PrefabsToLow : MonoBehaviour
//{
// void Start()
// {
// var resourcesPath = Application.dataPath;
// var absolutePaths = System.IO.Directory.GetFiles(resourcesPath, "*.prefab", System.IO.SearchOption.AllDirectories);
// for (int i = 0; i < absolutePaths.Length; i++)
// {
// string path = "Assets" + absolutePaths[i].Remove(0, resourcesPath.Length);
// path = path.Replace("\\", "/");
// try
// {
// Debug.Log(path);
// string newpath = path.Replace("Assets", "Assets/Newprefab");
// string newdir = Path.GetDirectoryName(newpath);
// if (!Directory.Exists(newdir))
// Directory.CreateDirectory(newdir);
// Debug.Log(newpath);
// GameObject prefab = Instantiate(UnityEditor.AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject);
// if (!prefab)
// {
// Debug.LogError($"生成错误[读取Null]{path}");
// continue;
// }
// UnityEditor.PrefabUtility.CreatePrefab(newpath, prefab);
// DestroyImmediate(prefab);
// }
// catch (Exception ex)
// {
// Debug.LogError($"生成错误[报错]{path},{ex.ToString()}");
// continue;
// }
// }
// return;
// //GameObject prefab = Instantiate(UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/Resources/UI/MainEventSystem.prefab", typeof(GameObject)) as GameObject);
// //UnityEditor.PrefabUtility.CreatePrefab("Assets/Prefabs/MainEventSystemClone.prefab", prefab);
// }
//}