uFrame插件導(dǎo)入報錯

最近想研究一下uFrame插件,于是從AssetStore下載了最新的uFrame插件。下載后導(dǎo)入到Unity是兩個版本的unitypackage包,分別是uFrame-1.5.1r2和uFrame-1.6.3r1。網(wǎng)上簡單查了一下,說兩個版本差別還是挺大的,新版本不能向前兼容。

一、擋路的狗(Bug)


我最后選擇了最新版本,雙擊后導(dǎo)入,導(dǎo)入完成后,控制臺出現(xiàn)如下錯誤:


Error1.png

一大堆錯誤的詳細(xì)信息就不一一列出了,第一個錯誤的詳細(xì)信息如下:

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)


當(dāng)我導(dǎo)入ExampleProject案例工程的unitypackage后,一切正常沒有報錯,接著,我選擇Window -> uFrameDesigner打開uFrame的可視化編輯器后,瘋狂的拋出如下異常:


Error2.png

異常詳細(xì)信息如下:

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圖片,然后修改圖片格式如下:

Image Setting.png

修改完后所有的都正常了。正在我得意的以為可以好好開始研究一下案例的時候,現(xiàn)實總是殘酷的。。。

三、死耗子(Error)


當(dāng)我選擇第一個場景雙擊打開點(diǎn)擊運(yùn)行后,發(fā)現(xiàn)報了如下錯誤:

Error3.png

詳細(xì)信息就不貼了,第一個問題很明顯,就是相應(yīng)的場景沒有添加進(jìn)Build Settings,反正也不知道場景的添加順序,我就直接把案例工程中的所有場景都添加進(jìn)Build Settings。然后,重新運(yùn)行就都正常了。終于可以開開心心的研究uFrame了

uFrame-1.5.1r2導(dǎo)入后也有很多錯誤,不過我懶得研究了。我喜歡用新版的,我是一個喜新厭舊的人。對uFrame-1.5.1r2感興趣的人可以自己研究一下。


如果本文有錯誤之處還請幫忙指出。


本文作者: Sheh偉偉
本文鏈接: http://davidsheh.github.io/2016/12/06/uFrame插件導(dǎo)入報錯/
版權(quán)聲明: 本博客所有文章除特別聲明外,均采用 CC BY-NC-SA 3.0 許可協(xié)議。轉(zhuǎn)載請注明出處!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容