批量修改名字

using UnityEditor;
using System.IO;
using UnityEngine;

public class SC
{
	[MenuItem("Assets/批量修改名字")]
	
	public static void PlacePrfab()
	{
		Object[] slecets = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
		
		foreach (Object item in slecets)
		{
			if (Path.GetExtension(AssetDatabase.GetAssetPath(item))!="")
			{
				
				string path = AssetDatabase.GetAssetPath(item);

				if(item.name.StartsWith("gt"))
				{
					var a = item.name.Substring(2);
					AssetDatabase.RenameAsset(path,"SCPoker"+a);
				}
			}
			
		}
		
		AssetDatabase.SaveAssets();
		
		AssetDatabase.Refresh();
		
	} 
}

  

posted on 2015-11-18 13:57  602147629  阅读(177)  评论(0编辑  收藏  举报