Created
January 11, 2016 06:15
-
-
Save benloong/91b5bdd53b7af248852b to your computer and use it in GitHub Desktop.
解决Unity UI timestamp guid不同步
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
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)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment