Closed yueh0607 closed 1 year ago
`Exception: Cannot load asset bundle file using LoadRawFileAsync method ! 麻烦您了,我似乎遇到了一个错误 LoadRawFileAsync是否在编辑器模拟模式下支持从AssetBundle加载 xxxx.dll.bytes为byte[]? 通过1.4.17 版本YooAsset源码 我发现在编辑器模式下会进行一个检查,检查当前bundleInfo的IsRawFile的值,我理解可能含义是检查这个bundle是否是RawFile,我理解不了这个地方的检查的含义是什么,这个错误是为了防止什么情况的发生?
以下是我的测试代码,我仅仅通过Tag拿到一系列的AssetInfo,然后在 var handle = YooAssets.LoadRawFileAsync(aotDll);处就提示这个错误 ` public async AirTask Initialize() { AssetInfo[] metaDataAssetInfos = YooAssets.GetAssetInfos("MetaDataAssembly"); await LoadAndSupplementaryMetaData(metaDataAssetInfos); }
private async AirTask LoadAndSupplementaryMetaData(AssetInfo[] AOTMetaAssemblyFiles) { HomologousImageMode mode = HomologousImageMode.SuperSet; foreach (var aotDll in AOTMetaAssemblyFiles) { var handle = YooAssets.LoadRawFileAsync(aotDll); await handle; byte[] dllBytes = handle.GetRawFileData(); handle.Dispose(); // 加载assembly对应的dll,会自动为它hook。一旦aot泛型函数的native函数不存在,用解释器版本代码 LoadImageErrorCode err = RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, mode); //Debug.Log($"LoadMetadataForAOTAssembly:{aotDllName}. mode:{mode} ret:{err}"); } }
`
下面是错误日志内容: Exception: Cannot load asset bundle file using LoadRawFileAsync method ! YooAsset.ResourcePackage.LoadRawFileInternal (YooAsset.AssetInfo assetInfo, System.Boolean waitForAsyncComplete) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/PackageSystem/ResourcePackage.cs:441) YooAsset.ResourcePackage.LoadRawFileAsync (YooAsset.AssetInfo assetInfo) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/PackageSystem/ResourcePackage.cs:419) YooAsset.YooAssets.LoadRawFileAsync (YooAsset.AssetInfo assetInfo) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/YooAssetsExtension.cs:111) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:61) AirFramework.AirTaskBase.PostException (System.Runtime.ExceptionServices.ExceptionDispatchInfo ex) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBase.cs:93) AirFramework.AirTaskBuilder.SetException (System.Exception exception) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:41) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:59) AirFramework.AirTaskBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:34) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at <e22d0233b756450da5d47f10215f7874>:0) AirFramework.HotUpdateModule.Initialize () (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:33) AirFramework.AirTaskBase.PostException (System.Runtime.ExceptionServices.ExceptionDispatchInfo ex) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBase.cs:93) AirFramework.AirTaskBuilder.SetException (System.Exception exception) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:41) AirFramework.HotUpdateModule.Initialize () (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:35) AirFramework.AirTaskBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:34) AirFramework.HotUpdateModule.Initialize () (at <e22d0233b756450da5d47f10215f7874>:0) AirFramework.UnityAirStarter.Awake () (at Assets/Framework/Runtime/UnityEnv/UnityStarter/UnityAirStarter.cs:46) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <b86a936aecae4655b240159decf8056b>:0) UnityEngine.UnitySynchronizationContext.Exec () (at <b86a936aecae4655b240159decf8056b>:0) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <b86a936aecae4655b240159decf8056b>:0)
Exception: Cannot load asset bundle file using LoadRawFileAsync method ! YooAsset.ResourcePackage.LoadRawFileInternal (YooAsset.AssetInfo assetInfo, System.Boolean waitForAsyncComplete) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/PackageSystem/ResourcePackage.cs:441) YooAsset.ResourcePackage.LoadRawFileAsync (YooAsset.AssetInfo assetInfo) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/PackageSystem/ResourcePackage.cs:419) YooAsset.YooAssets.LoadRawFileAsync (YooAsset.AssetInfo assetInfo) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/YooAssetsExtension.cs:111) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:61) AirFramework.AirTaskBase.PostException (System.Runtime.ExceptionServices.ExceptionDispatchInfo ex) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBase.cs:93) AirFramework.AirTaskBuilder.SetException (System.Exception exception) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:41) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:59) AirFramework.AirTaskBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:34) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at <e22d0233b756450da5d47f10215f7874>:0) AirFramework.HotUpdateModule.Initialize () (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:33) AirFramework.AirTaskBase.PostException (System.Runtime.ExceptionServices.ExceptionDispatchInfo ex) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBase.cs:93) AirFramework.AirTaskBuilder.SetException (System.Exception exception) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:41) AirFramework.HotUpdateModule.Initialize () (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:35) AirFramework.AirTaskBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:34) AirFramework.HotUpdateModule.Initialize () (at <e22d0233b756450da5d47f10215f7874>:0) AirFramework.UnityAirStarter.Awake () (at Assets/Framework/Runtime/UnityEnv/UnityStarter/UnityAirStarter.cs:46) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <b86a936aecae4655b240159decf8056b>:0) UnityEngine.UnitySynchronizationContext.Exec () (at <b86a936aecae4655b240159decf8056b>:0) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <b86a936aecae4655b240159decf8056b>:0)
OK,我懂了,在Collector里需要设置打包原生文件,谢谢
`Exception: Cannot load asset bundle file using LoadRawFileAsync method ! 麻烦您了,我似乎遇到了一个错误 LoadRawFileAsync是否在编辑器模拟模式下支持从AssetBundle加载 xxxx.dll.bytes为byte[]? 通过1.4.17 版本YooAsset源码 我发现在编辑器模式下会进行一个检查,检查当前bundleInfo的IsRawFile的值,我理解可能含义是检查这个bundle是否是RawFile,我理解不了这个地方的检查的含义是什么,这个错误是为了防止什么情况的发生?
以下是我的测试代码,我仅仅通过Tag拿到一系列的AssetInfo,然后在 var handle = YooAssets.LoadRawFileAsync(aotDll);处就提示这个错误 ` public async AirTask Initialize() { AssetInfo[] metaDataAssetInfos = YooAssets.GetAssetInfos("MetaDataAssembly"); await LoadAndSupplementaryMetaData(metaDataAssetInfos); }
`
下面是错误日志内容:
Exception: Cannot load asset bundle file using LoadRawFileAsync method ! YooAsset.ResourcePackage.LoadRawFileInternal (YooAsset.AssetInfo assetInfo, System.Boolean waitForAsyncComplete) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/PackageSystem/ResourcePackage.cs:441) YooAsset.ResourcePackage.LoadRawFileAsync (YooAsset.AssetInfo assetInfo) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/PackageSystem/ResourcePackage.cs:419) YooAsset.YooAssets.LoadRawFileAsync (YooAsset.AssetInfo assetInfo) (at Library/PackageCache/com.tuyoogame.yooasset@1.4.17/Runtime/YooAssetsExtension.cs:111) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:61) AirFramework.AirTaskBase.PostException (System.Runtime.ExceptionServices.ExceptionDispatchInfo ex) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBase.cs:93) AirFramework.AirTaskBuilder.SetException (System.Exception exception) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:41) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:59) AirFramework.AirTaskBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:34) AirFramework.HotUpdateModule.LoadHotUpdateAssembly (YooAsset.AssetInfo[] infos) (at <e22d0233b756450da5d47f10215f7874>:0) AirFramework.HotUpdateModule.Initialize () (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:33) AirFramework.AirTaskBase.PostException (System.Runtime.ExceptionServices.ExceptionDispatchInfo ex) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBase.cs:93) AirFramework.AirTaskBuilder.SetException (System.Exception exception) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:41) AirFramework.HotUpdateModule.Initialize () (at Assets/Framework/Runtime/UnityEnv/HybridCLR/HotUpdateModule.cs:35) AirFramework.AirTaskBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at Assets/Framework/Runtime/Core/Task/AsyncTask/AsyncTaskBuilder.cs:34) AirFramework.HotUpdateModule.Initialize () (at <e22d0233b756450da5d47f10215f7874>:0) AirFramework.UnityAirStarter.Awake () (at Assets/Framework/Runtime/UnityEnv/UnityStarter/UnityAirStarter.cs:46) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <b86a936aecae4655b240159decf8056b>:0) UnityEngine.UnitySynchronizationContext.Exec () (at <b86a936aecae4655b240159decf8056b>:0) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <b86a936aecae4655b240159decf8056b>:0)