Unity编译到Xcode自动添加AppIcon

1、将要添加的所有Icon放到指定目录:

Unity编译到Xcode自动添加AppIcon_第1张图片

2、拷贝Icon的方法:

	public static void CopyIcons(string pathToBuiltProject)
	{
		string appIconPath = Application.dataPath + "/Editor/XUPorter/AppIcon/";
		string[] iconflies = null;
		if (Directory.Exists(appIconPath))
		{
			iconflies = Directory.GetFiles(appIconPath);	
		}
		if (iconflies != null && iconflies.Length > 0)
		{
			appIconPath = pathToBuiltProject + "/Unity-iPhone/Images.xcassets/AppIcon.appiconset/";
			string[] icons = Directory.GetFiles(appIconPath);
			foreach (string file in icons)
			{
				Debug.Log("Delete icon:" + file);
				File.Delete(file);
			}
			foreach (string file in iconflies)
			{
				string fileName = file.Substring(file.LastIndexOf("/") + 1);
				if (fileName.EndsWith(".png") || fileName.EndsWith(".json"))
				{
					Debug.Log("Icon Name:" + fileName);	
					File.Copy(file, Path.Combine(appIconPath, fileName));
				}
			}
		}
	}


你可能感兴趣的:(Unity编译到Xcode自动添加AppIcon)