1.平台编译错误或库引用缺失
错误提示:error CS1061: Type `System.IO.FileInfo' does not contain a definition for `Delete' and no extension method `Delete' of type `System.IO.FileInfo' could be found (are you missing a using directive or an assembly reference?)
出了这个错误一般有两个原因了。
1.没有引用相关的库。
2.选错编译平台。(BuildSetting里面的Platform)
2.编码切换警告提示。
警告提示:Some are Mac OS X (UNIX) and some are Windows.
This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
编码格式问题,VS的话直接高级保存方案里面修改,一般我选的是UNICODE(UTF8代签名)MACINTOSH(CR),WINDOW下的可以选WINDOWS的格式,两边都要用的话,推荐选CR。
BUG:IOS下,游戏中的中文显示乱码。
解决方式:同上,修改改代码页的编码。UNICODE(UTF8代签名)MACINTOSH(CR)
3:`UnityEditor.BuildPipeline.BuildAssetBundles(string)' is obsolete: `BuildAssetBundles signature has changed. Please specify the targetPlatform parameter'
4:UnityEditor.UI.dll' is in timestamps but is not known in guidmapper...
解决方法:重新导入UnityEditor.UI.dll 参考来自:https://forum.unity3d.com/threads/unityengine-ui-dll-is-in-timestamps-but-is-not-known-in-assetdatabase.274492/
使用如下代码:
using UnityEngine;
using System.Collections.Generic;
using UnityEditor;
using System.Text.RegularExpressions;
using System.IO;
using System.Text;
public class ReimportUnityEngineUI {
[MenuItem("Assets/Reimport UI Assemblies", false, 100)]
public static void ReimportUI() {
#if UNITY_4_6
var path = EditorApplication.applicationContentsPath + "/UnityExtensions/Unity/GUISystem/{0}/{1}";
var version = Regex.Match(Application.unityVersion, @"^[0-9]+\.[0-9]+\.[0-9]+").Value;
#else
var path = EditorApplication.applicationContentsPath + "/UnityExtensions/Unity/GUISystem/{1}";
var version = string.Empty;
#endif
string engineDll = string.Format(path, version, "UnityEngine.UI.dll");
string editorDll = string.Format(path, version, "Editor/UnityEditor.UI.dll");
ReimportDll(engineDll);
ReimportDll(editorDll);
}
static void ReimportDll(string path) {
if (File.Exists(path))
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate | ImportAssetOptions.DontDownloadFromCacheServer);
else
Debug.LogError(string.Format("DLL not found {0}", path));
} }
适用于各个版本,我是在5.5.0版本上遇到的