最近想研究一下uFrame插件,于是從AssetStore下載了最新的uFrame插件猫十。下載后導入到Unity是兩個版本的unitypackage包蚓再,分別是uFrame-1.5.1r2和uFrame-1.6.3r1只损。網上簡單查了一下一姿,說兩個版本差別還是挺大的七咧,新版本不能向前兼容。
一叮叹、擋路的狗(Bug)
我最后選擇了最新版本艾栋,雙擊后導入,導入完成后蛉顽,控制臺出現(xiàn)如下錯誤:
一大堆錯誤的詳細信息就不一一列出了蝗砾,第一個錯誤的詳細信息如下:
Assets/uFrame/MVVM/Framework/Editor/Templates/uFrameTemplates.cs(144,48): error CS0246: The type or namespace name `UGUIExtensions' could not be found. Are you missing a using directive or an assembly reference?
分析了一下,發(fā)現(xiàn)是UGUIExtensions這個類因為某個原因沒找到携冤,然后悼粮,我直接用VS的全局搜索整個解決方案。最后曾棕,發(fā)現(xiàn)UGUIBindings.cs這個腳本中的UGUIExtensions類被宏命令屏蔽了扣猫,因為我使用的Unity版本是5.3.4f1,而UGUIBindings.cs這個腳本的第一行#if UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
直接不支持5.3.4f1翘地,所以解決辦法就是直接在第一行末尾追加|| UNITY_5_3
申尤。
改完保存編譯后,果然沒錯了衙耕。本來以為可以開始好好研究了昧穿,然而并非如此。
二臭杰、攔路虎(Exception)
當我導入ExampleProject案例工程的unitypackage后粤咪,一切正常沒有報錯谚中,接著渴杆,我選擇Window -> uFrameDesigner打開uFrame的可視化編輯器后,瘋狂的拋出如下異常:
異常詳細信息如下:
UnityException: Texture 'Header3' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
UnityEngine.Texture2D.GetPixels32 () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:336)
Invert.Common.TexturesExtensions.CutTextureBottomBorder (UnityEngine.Texture2D texture, Int32 cutSize) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner.Unity/ElementDesignerStyles.cs:1998)
Invert.Core.GraphDesigner.Unity.Schemas.UnityNodeStyleSchema.ConstructHeaderImage (Boolean expanded, Color color, System.String iconName) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner.Unity/Schemas/UnityNodeStyleSchema.cs:57)
Invert.Core.GraphDesigner.Schemas.impl.NodeStyleSchema.GetHeaderImage (Boolean expanded, Color color, System.String iconName) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Schemas/impl/NodeStyleSchema.cs:176)
Invert.Core.GraphDesigner.HeaderDrawer.Draw (IPlatformDrawer platform, Single scale) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Drawers/impl/HeaderDrawer.cs:97)
Invert.Core.GraphDesigner.DiagramNodeDrawer.DrawChildren (IPlatformDrawer platform, Single scale) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Drawers/impl/DiagramNodeDrawer.cs:356)
Invert.Core.GraphDesigner.DiagramNodeDrawer.Draw (IPlatformDrawer platform, Single scale) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Drawers/impl/DiagramNodeDrawer.cs:292)
Invert.Core.GraphDesigner.GenericNodeDrawer`2[TData,TViewModel].Draw (IPlatformDrawer platform, Single scale) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Drawers/impl/DiagramNodeDrawer.cs:64)
Invert.Core.GraphDesigner.DiagramDrawer.Draw (IPlatformDrawer platform, Single scale) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Drawers/impl/DiagramDrawer.cs:146)
Invert.Core.GraphDesigner.DesignerWindow.DrawDiagram (IPlatformDrawer drawer, Vector2 scrollPosition, Single scale, Rect diagramRect) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Windows/DesignerWindow.cs:349)
Invert.Core.GraphDesigner.DesignerWindow.Draw (IPlatformDrawer drawer, Single width, Single height, Vector2 scrollPosition, Single scale) (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner/Windows/DesignerWindow.cs:256)
Invert.Core.GraphDesigner.Unity.ElementsDesigner.OnGUI () (at D:/Invert/uFrameGit/uFrameTools/Invert.Core.GraphDesigner.Unity/ElementsDesigner.cs:256)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
這時宪塔,uFrame的編輯器窗口也是卡死狀態(tài)磁奖。通過分析報錯信息發(fā)現(xiàn),是因為一個名為Header3的圖片為非可讀的某筐,所以報錯了比搭。找到Header3圖片,然后修改圖片格式如下:
修改完后所有的都正常了南誊。正在我得意的以為可以好好開始研究一下案例的時候身诺,現(xiàn)實總是殘酷的。抄囚。霉赡。
三、死耗子(Error)
當我選擇第一個場景雙擊打開點擊運行后幔托,發(fā)現(xiàn)報了如下錯誤:
詳細信息就不貼了穴亏,第一個問題很明顯蜂挪,就是相應的場景沒有添加進Build Settings,反正也不知道場景的添加順序嗓化,我就直接把案例工程中的所有場景都添加進Build Settings棠涮。然后,重新運行就都正常了刺覆。終于可以開開心心的研究uFrame了
uFrame-1.5.1r2導入后也有很多錯誤严肪,不過我懶得研究了。我喜歡用新版的隅津,我是一個喜新厭舊的人诬垂。對uFrame-1.5.1r2感興趣的人可以自己研究一下。
如果本文有錯誤之處還請幫忙指出伦仍。
本文作者: Sheh偉偉
本文鏈接: http://davidsheh.github.io/2016/12/06/uFrame插件導入報錯/
版權聲明: 本博客所有文章除特別聲明外结窘,均采用 CC BY-NC-SA 3.0 許可協(xié)議。轉載請注明出處充蓝!