UE4.27 Runtime USD Import

Hello
I tried to use USD Stage Actor to import an USD file at runtime.
I used “Set Root Layer” node and it worked on PIE and Stand Alone but it did not work with packaged project.
But when I used that actor with “Spawn Actor from Class” it spawns and again, it does not work.

Is there any suggestion for it ?

1 Like

When you try to load usd in runtime with log enabled, there will be a error log :

*LogUsd: Error: The USD SDK is disabled because the executable is not forcing the ansi C allocator (you need to set ‘FORCE_ANSI_ALLOCATOR=1’ as a global definition on your project .Target.cs file). Read the comments at the end of UnrealUSDWrapper.Build.cs for more details.

Accordding to the error log, I add

BuildEnvironment =
TargetBuildEnvironment.Unique;
GlobalDefinitions.Add(“FORCE_ANSI_ALLOCATOR=1”);

Then, you should download your unreal engine from github.com and compile it by your own if you installed 4.27 from epic launcher, otherwise, you will meet another package error.

I gave up in this step because I decieded to switch to DatasmithRuntime to import scene in runtime for vray materials support.

Hope that helps.

1 Like

I helps a lot ! Thank you very much. I tried and got same errors. I wont try to compile engine because there are additional mechanics which I need to write. But I will try in the future.

I tried to use Datasmith Runtime but for CAD aspect, part names and hierarchy come broken. So I use GLTF Runtime.

I used your hints and right now I can successfully import USD files. Thank you !

Glad to hear that, have a good day friend.

Hey, Is it possible to import USD file in Packaged project If Yes can you tell me the steps to do that ???

Purpose :- I want to load all the assets in my game in runtime like i have a .CSV file that have all the data about location and rotation about the actor and the actor is in .USD format so I just want to read that .csv file and pick USD file From that location…

Thanks In Advance

Yes, it’s possible but you need to use source code version of Unreal Engine. Not client one.
After that just follow this steps.

Because client version of Unreal doesn’t support target.cs edits.

Has this been resolved in 5.0/5.1 using a launcher build to package? Would really like to be able to package using a launcher build but running into similar issues.

I haven’t tried it yet and won’t try it near future. But you can try it. Just try to import something to a template and package it. If there will be an error after target.cs edit, we can say you need source code.