Unity-Technologies / usd-unity-sdk

Integration of Pixar's Universal Scene Description into Unity. UPDATE: This package has been superseded by our new bundle of USD packages. Please see README & link below for further details.
https://forum.unity.com/threads/new-openusd-packages-now-available.1524583/
Apache License 2.0
500 stars 77 forks source link

Custom USD file format plugins #378

Closed nicolaspopravka closed 1 year ago

nicolaspopravka commented 1 year ago

We have a couple of issues with USD file format plugins and Unity. Bear with me as I realize neither 1. nor 2. below are strictly speaking because of the com.unity.formats.usd package. Here's what going on:

  1. Unity crashes on us some time after importing as game objects USD assets referencing files written in our proprietary file formats. The hacky workaround I found is to comment out this line. However, I believe the correct thing to do would be to update USD to a version more recent than v20.08. I would need to resurrect it, but I was able a while back to reproduce this crash outside of Unity in a simple test program, and then found out the problem was fixed using recent USD releases. The BUILDING.md file explains how to update USD, but is it something that is already being worked on, by any chance?

  2. This is more a general Unity question than a USD Unity SDK question, I think. One of the USD file format plugins depends on another DLL file. Let's call the USD plugin usdXYZ.dll and its dependency XYZ.dll. The only way I found for usdXYZ.dll to be loaded successfully into Unity at runtime is to set the PATH environment variable to point to where XYZ.dll exists. This sort of makes sense but typically it just works to have the DLL files that USD depends on under package directories. I am curious if this is to be expected and documented somewhere?

Thanks, Nicolas.

vickycl commented 1 year ago

Hey Nicolas!

Re 1: We are working on updating USD to v23, however due to compatibility issues with plugins used elsewhere in Unity, the version of this package that will support USD 23+ will be tied to Unity 2023.1 and up. We don't currently have a timescale for releasing this upgrade, because we're prioritizing fixes that will support users that are on current LTS Unity versions.

Re 2: This sounds similar to a known issue in the USD plugin: https://github.com/PixarAnimationStudios/USD/issues/2367. We have submitted a fix to Pixar for this here, but it hasn't landed. Hopefully this helps?

nicolaspopravka commented 1 year ago

It does help, thanks! Let me try patching our fork of USD with the fix from https://github.com/PixarAnimationStudios/USD/pull/2368 and test again. And good to know there is a plan to upgrade to a more recent version of USD.

nicolaspopravka commented 1 year ago

It was easy to cherry-pick https://github.com/PixarAnimationStudios/USD/pull/2368/commits/823ec1eeac5136aec752e00fcfc1bb636f07f122 in USD v20.08 and rebuild usd_ms.dll for the com.unity.formats.usd package, which seems to fix 2. for us : PATH is not needed anymore as long as usdXYZ.dll and XYZ.dll are in the same directory. Thanks again.

vickycl commented 1 year ago

Great! Glad we were able to help 😄