Description

virtual void UObject::CookAdditionalFilesOverride allows non-package files to be copied or created during the cook whenever a UObject of your class is in a package that is cooked. This is useful for files that are needed by or associated with a package file.

A shortcoming of this method is that it requires the data to be specified as an array of bytes in memory, which is inconvenient and poor performance if the file is already present on disk in the editor workspace.

Recommendedation 1: Add CookAdditionalFilesOverride version that specifies a source file on disk.

A shortcoming of this method is that it assumes the output file will be written to the same directory as the package file, and only provides the package filename without providing other directory information for where the targetfiles should be placed.

Recommendation 2: Add Context struct to the CookAdditionalFilesOverride function that provides paths to the sandbox root, and sandbox package content root (either projectcontent dir, enginecontent dir, or plugin content dir, in the sandbox).

Recommendation 3: The Context struct should include the localization information: TConstArrayView<FString> CookCultures, which should point to the array copied from FCookByTheBookStartupOptions.CookCultures.

Recommendation 4: Change the name of the WriteAdditionalFile function to WriteUniqueFile, per the design of [Link Removed] which needs to disambiguate it from WriteSharedFile.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-164889 in the post.

4
Login to Vote

Unresolved
ComponentUE - Foundation - Core - Cooker
Affects Versions4.27
Target Fix5.5
CreatedSep 23, 2022
UpdatedFeb 29, 2024