gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.01k stars 317 forks source link

Unity 2021.2.x and greater exception: "ArgumentException: Value must be a Com object." #112

Closed music4computers closed 2 years ago

music4computers commented 2 years ago

In Unity 2021.2 and greater the Windows explorer window will come up and you're able to select a file, but then you immediately get an "ArgumentException: Value must be a Com object." exception upon confirming the selection. Any guidance on what this exception means would be appreciated, thanks.

bodhid commented 2 years ago

@music4computers in case this project is not being worked on.

You can put a try/catch around "result = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));" and check the contents of fd.filenames. The dialog will still popup and the paths can be retrieved

music4computers commented 2 years ago

I ended up just launching a file browser through a background process, but hopefully your solution will help other people running into this issue. Thanks for the help.

music4computers commented 2 years ago

The Unity issue tracker claims this has been fixed: https://issuetracker.unity3d.com/issues/argumentexception-value-must-be-a-com-object-when-calling-system-dot-runtime-dot-interopservices-dot-marshal-dot-finalreleasecomobject