三月 15.2018.

0 Comment

//此脚本是解决UI脚本丢失

//步骤:将此脚本放到项目下的Edit文件夹下,如果没有,请自行创建

//步骤:点击窗口的Asstes → Reimport ui assemblies

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));

}

}

打赏

14dde901d2028a4432a65cc6d05aa356.png微信扫一扫,打赏作者吧~

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐