nesrak1 / UABEA

c# uabe for newer versions of unity
MIT License
1.15k stars 149 forks source link

Handle Unity version when both kinds are stripped #324

Closed Sunakaze26 closed 5 months ago

Sunakaze26 commented 5 months ago

Some files cause UABEA to crash when I press the button to change Texture Plugins. Other files do not crash. The only files that come to mind are all files that require the Unity Version to be specified when opened in AssetStudioGUI.

Crash Report :

System.NullReferenceException: Object reference not set to an instance of an object. at AudioPlugin.ExportAudioClipOption.SelectionValidForPlugin(AssetsManager am, UABEAPluginAction action, List1 selection, String& name) at UABEAvalonia.Plugins.PluginManager.GetPluginsThatSupport(AssetsManager am, List1 selectedAssets) in D:\a\UABEA\UABEA\UABEAvalonia\Plugins\PluginManager.cs:line 68 at UABEAvalonia.PluginWindow..ctor(Window win, AssetWorkspace workspace, List`1 selection, PluginManager plugLoader) in D:\a\UABEA\UABEA\UABEAvalonia\Forms\PluginWindow.axaml.cs:line 36 at UABEAvalonia.InfoWindow.BtnPlugin_Click(Object sender, RoutedEventArgs e) in D:\a\UABEA\UABEA\UABEAvalonia\Forms\InfoWindow.axaml.cs:line 408 at System.Threading.Tasks.Task.<>c.b__128_0(Object state) at Avalonia.Threading.SendOrPostCallbackDispatcherOperation.InvokeCore() at Avalonia.Threading.DispatcherOperation.Execute() at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation job) at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean fromExplicitBackgroundProcessingCallback) at Avalonia.Threading.Dispatcher.Signaled() at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg) at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken) at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) at UABEAvalonia.Program.Main(String[] args) in D:\a\UABEA\UABEA\UABEAvalonia\Program.cs:line 53

nesrak1 commented 5 months ago

The only files that come to mind are all files that require the Unity Version to be specified when opened in AssetStudioGUI.

This is probably the issue. I removed the version selector from UABEA because usually if the assets file has a stripped unity version, the asset bundle it came from would have the actual version. But it seems like some bundles exist that have neither, so I might have to add that back. the audio clip plugin is fine, it's just that it can't read anything since it's trying to read it with version 0 of unity which falls back to the earliest unity version possible.

If you can build the project, I recommend changing this line here https://github.com/nesrak1/UABEA/blob/master/UABEAvalonia/Forms/MainWindow.axaml.cs#L595 to this instead as a temporary solution.

am.LoadClassDatabaseFromPackage("2019.1.4f1"); // replace your unity version here
Sunakaze26 commented 5 months ago

Thank you. I seem to be able to open it now. But when I built again and looked at Plugins, the Texture Plugin and other options were no longer available. What should I do?

nesrak1 commented 5 months ago

In visual studio, you can do ctrl+shift+B or right click the solution in the file tree view and click build to build everything. Or, you might be able to copy the runtimes folder and plugins folder from a nightly build into your new build (at UABEAvalonia/bin/Debug/net6.0/ or something) if you can't get the c++ code to compile.

Sunakaze26 commented 5 months ago

Everything was done perfectly. Thank you so much.