How can I cook a single asset using C++ in UE4

Hi! I want to test cook an asset using C++ but I could not find any useful information about how to do it on the internet. Dose anyone know how to make it?

Cooking a single asset in C++ is essentially calling SavePackage with a specific cook context. To build this pipeline, you need to:

  1. Call BeginCacheForCookedPlatformData on the asset for your target platform.

  2. Wait for all asynchronous shader compilations and UE5 AssetCompile tasks to finish.

  3. Call SavePackage using the correct PackageWriter, depending on whether your project uses traditional Pak files or IoStore.

If your end goal is just to quickly update specific assets in a live game and you’d rather not build and maintain all this boilerplate C++, I developed a plugin called Runtime Details that handles this exact low-level process.

With our Asset Hot Update feature, you can select specific assets, and the tool will automatically run this entire C++ cook pipeline, generate the Pak or IoStore file, and push it directly to your running Packaged Build over the network.