项目多语言需要 不是正式版本 随手测试用
代码
public static void Start()
{
if (Selection.objects.Length > 0)
{
GameObject gameObject = Selection.objects[0] as GameObject;
string a = AssetDatabase.GetAssetPath(gameObject).Replace(gameObject.name+ ".prefab", "");
string path = a + gameObject.name + "cn.prefab";
var temp= PrefabUtility.InstantiatePrefab(gameObject) as GameObject;
temp.name = "bb.prefab";
PrefabUtility.SaveAsPrefabAsset(temp, "Assets/Scenes/" + temp.name);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Object.DestroyImmediate(temp.gameObject);
}
望各位大佬指正
|