Has anyone actually got USD to work at runtime on a packaged build!

Please, I really need help on this for a crucial project!

I am trying to get a USD animation to run from a packaged project, but I’ve spent more than a couple of weeks with no real success! Has anyone actually got USD to load and play correctly without crashes or errors? I have experimented with Unreal engine 5.3 and 5.4.

On Unreal 5.3 and 5.4, this setup runs in testing, but unfortunately does not work in runtime build.
There has been years of development into supporting USD in Unreal Engine, but I am surprised that it does not actually work in practice when the project is built at Runtime!! By default, USD seems to be disabled for runtime (packaged game build). From reading available docs and forum posts, it seems that the following convoluted route is needed – but it still ends up with fatal errors on runtime in 5.3 and totally not working in 5.4.

Unreal 5.4 - Does not complete packaging build. Many errors in the build output log.
Unreal 5.3 – The USD is visible at runtime momentarily, but a fatal crash occurs instantly.
Unreal 5.2 - Unknown (still working on making the build from sourcecode)

I referred to these forum posts and help pages:

This is my process:

  • Build Unreal engine from source (clone repository from Github, build in Visual studio 2022, make new c++ game project with the newly built windows binary, load project from within Visual studio, add USD plugin, close project.
  • In Visual Studio, add new line of code to the project’s Project.Target.cs :
  
GlobalDefinitions.Add("FORCE_ANSI_ALLOCATOR=1");
  • Run the Unreal project, and add the USD plugin.

  • Create USD stage, and populate it with a USD.

  • In the level blueprint, on BeginPlay, use ‘Set Root Layer’ node (includes the USD’s local path, manually copied into the field) and connect in the USD stage actor into the ‘Set Root Layer’ node.
    (link to Epic help page)

  • Run a packaging build for windows.

Any help or advice on this would be appreciated!

Hi,
I also didn´t manage to get it working in a packaged project yet.

But if you check the Build.cs file of the USDWrapper here:
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Plugins/Importers/USDImporter/Source/UnrealUSDWrapper/UnrealUSDWrapper.Build.cs

at the very bottom, a comment describes that you need these two lines in your project.target.cs

GlobalDefinitions.Add(“FORCE_ANSI_ALLOCATOR=1”);
GlobalDefinitions.Add(“UE_USE_MALLOC_FILL_BYTES=0”);

Hi @BMWDominic ,
Thanks for your message.

Yes the two lines are definitely needed to be added to the project.target.cs for the USD packaging.

This is interesting - Unreal Engine 5.3 and 5.4 still crashes when the packaged game is run (with a fatal error). But it works in compiled versions of the latest UE5-main build (from github) which is essentially an early 5.5. This is very promising!

If anyone understands why there’s a fatal error on packaged 5.3 and 5.4 runtime exe’s that contain USD, please get in touch!

Hi there,

I have the same issue, but for another plugin.

Essentially I also have to add the two lines to my Project.Target.cs:

GlobalDefinitions.Add(“FORCE_ANSI_ALLOCATOR=1”);
GlobalDefinitions.Add(“UE_USE_MALLOC_FILL_BYTES=0”);

In my case, when I add those lines I can’t package shipping builds. It works with ‘Development’ or ‘DebugGame’ builds (specifically for iOS) without those lines. The error that pops-up, when those lines are added looks like this on my end:


UATHelper: Packaging (IOS): ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes'
PackagingResults: Warning: Could not find or use auto-linked framework 'CoreAudioTypes'
UATHelper: Packaging (IOS): Undefined symbols for architecture arm64:
UATHelper: Packaging (IOS): "StdRealloc(void*, unsigned long, unsigned long)", referenced from:
UATHelper: Packaging (IOS): void Eigen::internal::minimum_degree_ordering<float, int>(Eigen::SparseMatrix<float, 0, int>&, Eigen::PermutationMatrix<-1, -1, int>&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): void Eigen::internal::minimum_degree_ordering<double, int>(Eigen::SparseMatrix<double, 0, int>&, Eigen::PermutationMatrix<-1, -1, int>&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): Eigen::internal::conservative_resize_like_impl<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, false>::run(Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>>&, long, long) in Module.DynamicMesh.3.cpp.o
UATHelper: Packaging (IOS): "StdFree(void*)", referenced from:
UATHelper: Packaging (IOS): Chaos::TBlockSparseSymmetricLinearSystem<float, 3>::TBlockSparseSymmetricLinearSystem() in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): Chaos::TBlockSparseSymmetricLinearSystem<float, 3>::FPimpl::Reset(int) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): bool Chaos::TBlockSparseSymmetricLinearSystem<float, 3>::FPimpl::Solve<Eigen::DiagonalPreconditioner<float>>(TArrayView<Chaos::TVector<float, 3> const, int> const&, TArrayView<Chaos::TVector<float, 3>, int> const&, int, float, bool, int*, float*) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): void UE::Core::Private::PimplPtr::DeleterFunc<Chaos::TBlockSparseSymmetricLinearSystem<float, 3>::FPimpl>(void*) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): Eigen::ConjugateGradient<Eigen::SparseMatrix<float, 1, int>, 3, Eigen::DiagonalPreconditioner<float>>& Eigen::IterativeSolverBase<Eigen::ConjugateGradient<Eigen::SparseMatrix<float, 1, int>, 3, Eigen::DiagonalPreconditioner<float>>>::compute<Eigen::SparseMatrix<float, 1, int>>(Eigen::EigenBase<Eigen::SparseMatrix<float, 1, int>> const&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS):       Eigen::IterativeSolverBase<Eigen::ConjugateGradient<Eigen::SparseMatrix<float, 1, int>, 3, Eigen::DiagonalPreconditioner<float>>>::IterativeSolverBase() in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): Eigen::DiagonalPreconditioner<float>& Eigen::DiagonalPreconditioner<float>::factorize<Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>>>(Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>> const&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): ...
UATHelper: Packaging (IOS):  "StdMalloc(unsigned long, unsigned long)", referenced from:
UATHelper: Packaging (IOS): Chaos::TBlockSparseSymmetricLinearSystem<float, 3>::TBlockSparseSymmetricLinearSystem() in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS):  Chaos::TBlockSparseSymmetricLinearSystem<float, 3>::FPimpl::Reset(int) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS):       Eigen::IterativeSolverBase<Eigen::ConjugateGradient<Eigen::SparseMatrix<float, 1, int>, 3, Eigen::DiagonalPreconditioner<float>>>::IterativeSolverBase() in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): Eigen::DiagonalPreconditioner<float>& Eigen::DiagonalPreconditioner<float>::factorize<Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>>>(Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>> const&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): void Eigen::internal::conjugate_gradient<Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1> const, 0, Eigen::Stride<0, 0>>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0>>, Eigen::DiagonalPreconditioner<float>>(Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>> const&, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1> const, 0, Eigen::Stride<0, 0>> const&, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0>>&
, Eigen::DiagonalPreconditioner<float> const&, long&, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0>>::RealScalar&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): void Eigen::internal::assignment_from_xpr_op_product<Eigen::Matrix<float, -1, 1, 0, -1, 1>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1> const, 0, Eigen::Stride<0, 0>>, Eigen::Product<Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0>>, 0>, Eigen::internal::assign_op<float, float>, Eigen::internal::sub_assign_op<float, float>>::run<Eigen::CwiseBinaryOp<Eigen::internal::scalar_difference_op<float, float>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1> co
nst, 0, Eigen::Stride<0, 0>> const, Eigen::Product<Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0>>, 0> const>, Eigen::internal::assign_op<float, float>>(Eigen::Matrix<float, -1, 1, 0, -1, 1>&, Eigen::CwiseBinaryOp<Eigen::internal::scalar_difference_op<float, float>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -1, 1> const, 0, Eigen::Stride<0, 0>> const, Eigen::Product<Eigen::Ref<Eigen::SparseMatrix<float, 1, int> const, 0, Eigen::OuterStride<-1>>, Eigen::Map<Eigen::Matrix<float, -1, 1, 0, -
1, 1>, 0, Eigen::Stride<0, 0>>, 0> const> const&, Eigen::internal::assign_op<float, float> const&) in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): void Eigen::DiagonalPreconditioner<float>::_solve_impl<Eigen::Matrix<float, -1, 1, 0, -1, 1>, Eigen::Matrix<float, -1, 1, 0, -1, 1>>(Eigen::Matrix<float, -1, 1, 0, -1, 1> const&, Eigen::Matrix<float, -1, 1, 0, -1, 1>&) const in Module.Chaos.11.cpp.o
UATHelper: Packaging (IOS): ...
UATHelper: Packaging (IOS): ld: symbol(s) not found for architecture arm64
UATHelper: Packaging (IOS): clang: error: linker command failed with exit code 1 (use -v to see invocation)

Based on an answer I received on Unreal Slackers Discord there seems to be a fix available if you have UDN access, or it will probably ship with 5.5:

Do you have P4 access? I believe this fixed by P4 CL 31807575 (JIRA UE-207636), which will be available in UE5.5.

Hi @Thoeme,

Thanks for your reply!

Generally, my latest update on this is that all versions of UE 5.3 and 5.4 crash in one way or another with USD at packaging time. In 5.4 I had the USD show up briefly in the packaged build (if it didn’t crash during packaging), but I still repeatedly get the fatal error when the game starts playing.

Building UE 5.5 (ue5-main) from the source code is generally working, but there is the significant problem that the UsdActor stage keeps on unloading everytime the game is simulated (makes development testing very difficult). I just hope the developers fix this before the UE 5.5 release!

At the moment, we have paused development with USD because it unfortunately doesn’t seem to be properly supported yet for packaging (we can’t rely on it for live projects for clients).

1 Like