USD runtime loading, GlobalDefinitions error

Having trouble loading USD files at runtime.

According to UE docs:
Universal Scene Description in Unreal Engine | Unreal Engine Documentation

I need to add this line to project.Target.cs:

If I do this, I get the error:
Packaging (Mac): ERROR: project modifies the value of GlobalDefinitions. This is not allowed, as project has build products in common with UE4Game.

Elsewhere on the web it is suggested to also add:
BuildEnvironment = TargetBuildEnvironment.Unique;

However this results in error:
ERROR: Targets with a unique build environment cannot be built an installed engine.

Anybody have clues as to what is wrong and how to solve?

For any future people looking, the solve is to compile your own editor, and create the USD project (with recommended adjustments) from that editor.

Where did you find your project’s target.cs file? In the documentation, it mentioned it’s located at: UE_(version)\Engine\Source

When I look there, there’s only:

  • UE4Editor.Target.cs
  • UE4Game.Target.cs

I thought I actually found my target’s cs file in:

However it only appeared after the project was packaged, and if I modify it to add GlobalDefinitions.Add(“FORCE_ANSI_ALLOCATOR=1”); then it just automatically removes that line the next time the project is built.

Appreciate you findings on that it can be solved by compiling the editor, but does a solution exist yet without having to do so? The information on the Unreal Documentation seems incomplete or out of date.

I haven’t found a solution without having my own compiled editor.

Once you’re working with your own editor, the file to edit is: