[Cook Warning] LogText: Warning: Saving FText "" which has been initialized from FString at cook time resave of source package /Game/MyUserStruct may fix issue.

Cook warnings occur when a user-defined-structure asset indirectly contains an FText via a native C++ struct. This is due to the way user-defined-structures initialize default values via a string in .ini-style structure syntax. The quoted string is parsed from here and passed to `FText::FromString`, resulting in the cook warning later on.

To handle the case of default text initialization, we have modified `FTextStringHelper::ReadFromBuffer` to construct the string with `FText::GetEmpty` rather than `FText::FromString`. Attached is a patch of our change.

Steps to Reproduce

  1. Create a native C++ struct containing an editable FText property
  2. Create a user-defined-structure asset containing a property of the native struct
  3. Reference the user-defined-structure from somewhere in the project (e.g. as a Game Mode variable)
  4. Cook the project (for any platform)

Hi Jack,

I’m not sure why the warning was not being triggered for me before, but I’ve now been able to repro it on all UE versions since 5.4, and it is probably even older than that.

I just filed an internal bug report for this, here’s the link for the bug tracker: UE-331630. It should become available once the engine devs mark it as public.

Best regards,

Vitor

Hi Jack,

I’m looking into this now and should get back to you soon. Your fix seems appropriate, but I was unsuccessful in my first attempt at reproducing the issue. While I do other tests, can you please confirm that this warning pops up while developing in Windows and cooking for the Windows platform from inside the running Editor? How exactly are you launching the cook process?

Best regards,

Vitor

Hi Vitor,

Yes, I reproduced the Warning on //UE5/Release-5.6 44394996 just by invoking Platforms > Windows > Cook Content.

Within a minute of starting the cook, I see a log snippet like the following:

UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for ColorMaskBrushMaterial in PCD3D_SM6, Default, SM6, Game (DDC key hash: fd01d444b5bb1012ad4f0bf8c42c752ad4dbd82f), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for LandscapeDirtyMaterial in PCD3D_SM6, Default, SM6, Game (DDC key hash: b920774d974c1831452ebbf7e7cf91f3bab4c547), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for EmissiveMeshMaterial in PCD3D_SM6, Default, SM6, Game (DDC key hash: abc91f090cf60978805d9011293b8165bb987658), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for M_InvalidLightmapSettings in PCD3D_SM6, Default, SM6, Game (DDC key hash: d205d0d633eb0d8f9dd1511474b5d5fb4d0355a0), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for FlattenMaterial in PCD3D_SM6, Default, SM6, Game (DDC key hash: b911bbbeb6b50e0a44d78b298c12114b6040657a), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for FlattenMaterial_VT in PCD3D_SM6, Default, SM6, Game (DDC key hash: 0650906ab0350a2b62bad2efdc6da29e862813e1), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for FlattenMaterial_WS_Normal_VT in PCD3D_SM6, Default, SM6, Game (DDC key hash: 5955fb8172aa05fdb37b59e40402a094e4525b12), compiling.
UATHelper: Cooking (Windows): LogText: Warning: Saving FText "" which has been initialized from FString at cook time resave of source package /Game/MyGameMode may fix issue.
UATHelper: Cooking (Windows): LogText: Warning: Saving FText "" which has been initialized from FString at cook time resave of source package /Game/MyUserStruct may fix issue.
PackagingResults: Warning: Saving FText "" which has been initialized from FString at cook time resave of source package /Game/MyGameMode may fix issue.
PackagingResults: Warning: Saving FText "" which has been initialized from FString at cook time resave of source package /Game/MyUserStruct may fix issue.
UATHelper: Cooking (Windows): LogCook: Display: Cooked packages 252 Packages Remain 278 Total 530
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for M_DefaultOddSquare in PCD3D_SM5, Default, SM5, Game (DDC key hash: eb7ad5ce83bf415dd482b3974514b43c44a13f4e), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for Main in PCD3D_SM5, Default, SM5, Game (DDC key hash: f9c9c94014ed50a511eb89374fe0b4d441697130), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for Xray in PCD3D_SM5, Default, SM5, Game (DDC key hash: e70f2292de8e3b2db74ef55681c3aabf85f530da), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for CineMat in PCD3D_SM5, Default, SM5, Game (DDC key hash: ee13a478de57b011a306d8dce2e76c4b48dcf53b), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for SplineEditorMeshMat in PCD3D_SM5, Default, SM5, Game (DDC key hash: 6fe83bf68ebdd797ee59ab1ce68922a4cc0c4272), compiling.
UATHelper: Cooking (Windows): LogMaterial: Display: Missing cached shadermap for HairDefaultMaterial in PCD3D_SM5, Default, SM5, Game (DDC key hash: 62a8d57a3c9fd693ea9a590d43c16960bdccdd81), compiling.

Thank you Vitor!

I found references to the same warning going back 8 years (e.g. [Content removed] but I’m not certain if that also involved user defined structs.

Adding a trap to FText::FromString helped isolate the root cause.