nesrak1 / UABEA

c# uabe for newer versions of unity
MIT License
1.21k stars 153 forks source link

Can't deserialize Monobehaviour while using "datapack.unity3d" #268

Closed LunarExpress closed 1 year ago

LunarExpress commented 1 year ago

Describe the bug I'm trying to export a monobehaviour txt file from datapack.unity3d file,dlls are all ready,But uabea will stop working and crash when i click export dump. Whether i closed the cpp2il or open it,the problem is same.But export raw dat file are working fine. To Reproduce Steps to reproduce the behavior:

  1. Open a "datapack.unity3d" file
  2. Use il2cppdumper making dll
  3. Export a Monobehaviour dump
  4. Crash

Here's the crash report;

System.NullReferenceException: Object reference not set to an instance of an object.
   at UABEAvalonia.AssetImportExport.RecurseTextDump(AssetTypeValueField field, Int32 depth) in D:\a\UABEA\UABEA\UABEAvalonia\AssetImportExport.cs:line 42
   at UABEAvalonia.AssetImportExport.DumpTextAsset(StreamWriter sw, AssetTypeValueField baseField) in D:\a\UABEA\UABEA\UABEAvalonia\AssetImportExport.cs:line 37
   at UABEAvalonia.InfoWindow.SingleExportDump(List`1 selection) in D:\a\UABEA\UABEA\UABEAvalonia\InfoWindow.axaml.cs:line 750
   at UABEAvalonia.InfoWindow.BtnExportDump_Click(Object sender, RoutedEventArgs e) in D:\a\UABEA\UABEA\UABEAvalonia\InfoWindow.axaml.cs:line 332
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 38
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 298
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 215
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 122
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 214
   at UABEAvalonia.Program.Main(String[] args) in D:\a\UABEA\UABEA\UABEAvalonia\Program.cs:line 53
nesrak1 commented 1 year ago

This sounds like #263 which was fixed in nightly. Are you using release 6 or nightly?

LunarExpress commented 1 year ago

This sounds like #263 which was fixed in nightly. Are you using release 6 or nightly?

It won't crush again in nightly build,but still cannot deserialize monobehaviour Exported txt says"Asset failed to deserialize."

nesrak1 commented 1 year ago

Unfortunately these monobehaviour issues are hard to solve, especially if they're in a bundle. Check your file's type tree info (F5). Does the window on the left say "this file does not have typetrees" or something like that? If so, then the il2cppdump'd files will actually be needed (in a folder called Managed in the same folder as the bundle). Most of the time, this isn't the case and I wouldn't expect bundles to fail. Also, if it has generics it might be fixed in the latest version of AssetsTools which UABEA doesn't have yet.

If you want to test the new version, you can try using UABEANext: https://nightly.link/nesrak1/UABEANext/workflows/build-windows/master/uabea-windows.zip

If it works there, then the issue will be resolved when AssetsTools is updated here in UABEA. If not, then it'll need more investigation.

LunarExpress commented 1 year ago

Unfortunately these monobehaviour issues are hard to solve, especially if they're in a bundle. Check your file's type tree info (F5). Does the window on the left say "this file does not have typetrees" or something like that? If so, then the il2cppdump'd files will actually be needed (in a folder called Managed in the same folder as the bundle). Most of the time, this isn't the case and I wouldn't expect bundles to fail. Also, if it has generics it might be fixed in the latest version of AssetsTools which UABEA doesn't have yet.

If you want to test the new version, you can try using UABEANext: https://nightly.link/nesrak1/UABEANext/workflows/build-windows/master/uabea-windows.zip

If it works there, then the issue will be resolved when AssetsTools is updated here in UABEA. If not, then it'll need more investigation.

From a long period of work,I found that if the file name is"datapack.unity3d",there will occur the problem,not only this game.Do you know how to build this file from unity? I tried many times but there's only data.unity3d in the directory.

lt1023 commented 1 year ago

I miss this problem too!!! image the "data.unity3d" file is correctly, but the "datapack.unity3d " file is not.

lt1023 commented 1 year ago

image

lt1023 commented 1 year ago

https://apkcombo.com/zh/liminal-gallery-game/com.gamegallery.LiminalGallery.liminal/

nesrak1 commented 1 year ago

I fixed Asset failed to deserialize by just updating AssetsTools.NET (which is now in nightly). That still won't fix the main issue, which is that MonoScripts (needed by MonoBehaviours) are in the other bundle, and since you can't open two bundles, you can't normally view the MonoBehaviour. A workaround would be to Export All on both data.unity3d and datapack.unity3d into the Data folder, and if you have any changes to make, you can manually re-Import the specific files you edited.

LunarExpress commented 1 year ago

I fixed Asset failed to deserialize by just updating AssetsTools.NET (which is now in nightly). That still won't fix the main issue, which is that MonoScripts (needed by MonoBehaviours) are in the other bundle, and since you can't open two bundles, you can't normally view the MonoBehaviour. A workaround would be to Export All on both data.unity3d and datapack.unity3d into the Data folder, and if you have any changes to make, you can manually re-Import the specific files you edited.

That is helpful,problem is solved,so much appreciate.