liangxiegame / QFramework

Godot/Unity3D System Design Architecture
https://qframework.cn
MIT License
4.46k stars 779 forks source link

UIKit 中 UIPanelTester 报错,无法正确加载面板 #105

Closed chaos-lsc closed 1 year ago

chaos-lsc commented 1 year ago

我的 Unity 版本是 2021.3.12f1c2,Qframework 版本 1.0.35

根据教程为 BasePanel 添加了 AssetBundle Mark,并自动生成代码 场景中添加 UIPanelTester 并做了如下设置: image

报错

  1. Failed to Create Res. Not Find By ResSearchKeys:AssetName:basepanel BundleName: TypeName:UnityEngine.GameObject UnityEngine.Debug:LogError (object) QFramework.ResFactory:Create (QFramework.ResSearchKeys) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResFactory.cs:46) QFramework.ResMgr:GetRes (QFramework.ResSearchKeys,bool) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResMgr.cs:213) QFramework.ResLoader:Add2Load (QFramework.ResSearchKeys,System.Action 2<bool, QFramework.IRes>,bool) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoader.cs:202) QFramework.ResLoader:LoadResSync (QFramework.ResSearchKeys) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoader.cs:87) QFramework.ResLoader:LoadAssetSync (QFramework.ResSearchKeys) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoader.cs:269) QFramework.IResLoaderExtensions:LoadSync<UnityEngine.GameObject> (QFramework.IResLoader,string) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/IResLoaderExtensions.cs:38) QFramework.ResKitPanelLoaderPool/ResKitPanelLoader:LoadPanelPrefab (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/SupportOldQF/UIKitWithResKitInit.cs:39) QFramework.UIKitConfig:LoadPanel (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIKitConfig.cs:45) QFramework.UIManager:CreateUI (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIManager.cs:216) QFramework.UIManager:OpenUI (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIManager.cs:102) QFramework.UIKit:OpenPanel (string,QFramework.UILevel,string) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIKit.cs:287) QFramework.UIPanelTester/<Start>d__4:MoveNext () (at Assets/QFramework/Toolkits/UIKit/Scripts/Script/UIPanelTester.cs:70) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

  2. Failed to Load Res:AssetName:basepanel BundleName: TypeName:UnityEngine.GameObject UnityEngine.Debug:LogError (object) QFramework.ResLoader:LoadResSync (QFramework.ResSearchKeys) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoader.cs:93) QFramework.ResLoader:LoadAssetSync (QFramework.ResSearchKeys) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoader.cs:269) QFramework.IResLoaderExtensions:LoadSync<UnityEngine.GameObject> (QFramework.IResLoader,string) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/IResLoaderExtensions.cs:38) QFramework.ResKitPanelLoaderPool/ResKitPanelLoader:LoadPanelPrefab (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/SupportOldQF/UIKitWithResKitInit.cs:39) QFramework.UIKitConfig:LoadPanel (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIKitConfig.cs:45) QFramework.UIManager:CreateUI (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIManager.cs:216) QFramework.UIManager:OpenUI (QFramework.PanelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIManager.cs:102) QFramework.UIKit:OpenPanel (string,QFramework.UILevel,string) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIKit.cs:287) QFramework.UIPanelTester/<Start>d__4:MoveNext () (at Assets/QFramework/Toolkits/UIKit/Scripts/Script/UIPanelTester.cs:70) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

  3. NullReferenceException: Object reference not set to an instance of an object QFramework.ResLoader.LoadAssetSync (QFramework.ResSearchKeys resSearchKeys) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoader.cs:269) QFramework.IResLoaderExtensions.LoadSync[T] (QFramework.IResLoader self, System.String assetName) (at Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/IResLoaderExtensions.cs:38) QFramework.ResKitPanelLoaderPool+ResKitPanelLoader.LoadPanelPrefab (QFramework.PanelSearchKeys panelSearchKeys) (at Assets/QFramework/Toolkits/SupportOldQF/UIKitWithResKitInit.cs:39) QFramework.UIKitConfig.LoadPanel (QFramework.PanelSearchKeys panelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIKitConfig.cs:45) QFramework.UIManager.CreateUI (QFramework.PanelSearchKeys panelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIManager.cs:216) QFramework.UIManager.OpenUI (QFramework.PanelSearchKeys panelSearchKeys) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIManager.cs:102) QFramework.UIKit.OpenPanel (System.String panelName, QFramework.UILevel level, System.String assetBundleName) (at Assets/QFramework/Toolkits/UIKit/Scripts/UIKit.cs:287) QFramework.UIPanelTester+<Start>d__4.MoveNext () (at Assets/QFramework/Toolkits/UIKit/Scripts/Script/UIPanelTester.cs:70) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <c6956609c5d74f5d8e6ed4e5e5f40cc2>:0)

GanZX666 commented 1 year ago

我也遇到了这个问题,请问解决了吗?

chaos-lsc commented 1 year ago

我也遇到了这个问题,请问解决了吗?

没有按照教程的顺序,直接使用UIKit创建服务生成UIPanel,在生成的场景里面肯定是能运行的,所以没有再纠结为什么会出这种问题了