|
26 | 26 | using HybridCLR; |
27 | 27 | using System; |
28 | 28 | using System.Collections.Generic; |
| 29 | +using System.IO; |
29 | 30 | using System.Reflection; |
30 | 31 | using System.Threading.Tasks; |
31 | 32 | using Cysharp.Threading.Tasks; |
@@ -308,17 +309,20 @@ await MessageBox.Show("Error", $"Scene loading failed: {exception.Message}", |
308 | 309 | #if UNITY_EDITOR |
309 | 310 | // In editor, load directly from file system. Cannot read encrypted files. Encrypted files can only run on real devices. |
310 | 311 | var hotUpdateDllBytes = |
311 | | - await System.IO.File.ReadAllBytesAsync($"Library/ScriptAssemblies/{hotCodeName}"); |
| 312 | + await File.ReadAllBytesAsync($"Library/ScriptAssemblies/{hotCodeName}"); |
| 313 | + var hotUpdatePdbBytes = await File.ReadAllBytesAsync( |
| 314 | + $"Library/ScriptAssemblies/{Path.ChangeExtension(hotCodeName, "pdb")}"); |
| 315 | + Assembly hotUpdateAss = Assembly.Load(hotUpdateDllBytes, hotUpdatePdbBytes); |
312 | 316 | #else |
313 | 317 | var dllHandle = |
314 | 318 | package.LoadAssetAsync<TextAsset>($"Assets/HotUpdate/Compiled/{hotCodeName}.bytes"); |
315 | 319 | await dllHandle.Task; |
316 | 320 | TextAsset hotUpdateDllAsset = dllHandle.GetAssetObject<TextAsset>(); |
317 | 321 | var hotUpdateDllBytes = hotUpdateDllAsset.bytes; |
318 | 322 | dllHandle.Release(); |
| 323 | + Assembly hotUpdateAss = Assembly.Load(hotUpdateDllBytes); |
319 | 324 | #endif |
320 | 325 |
|
321 | | - Assembly hotUpdateAss = Assembly.Load(hotUpdateDllBytes); |
322 | 326 | await LoadHotCode(hotUpdateAss); |
323 | 327 |
|
324 | 328 | // If we reach here, initialization was successful, break out of the retry loop |
@@ -534,6 +538,10 @@ private async UniTask<bool> UpdatePackageImpl(ResourcePackage package, |
534 | 538 | throw new NotSupportedException($"Target platform {targetPlatform} is not supported yet."); |
535 | 539 | } |
536 | 540 |
|
| 541 | + if (initParameters == null) |
| 542 | + throw new InvalidOperationException( |
| 543 | + $"Failed to create initialization parameters for package platform {targetPlatform} (current build target platform: {Application.platform})"); |
| 544 | + |
537 | 545 | initOperation = package.InitializeAsync(initParameters); |
538 | 546 | } |
539 | 547 |
|
|
0 commit comments