Download

"Assertion failed ToBuild.IsValid" when cooking

I hit this for the past week while on version 4.22 preview1 and 3 when cooking our data. I wanted to let everyone know that this assert from line 2178 in CookOnTheFlyServer.cpp is due to an asset named “None” or rather a null asset.

If you receive this, the reason is that you have an asset that is cooked and then a sub-asset fails cooking. In order to figure out what asset is the problem, I added these lines to CookOnTheFlyServer.cpp, at Line 2822:
UPackage* Package2 = PackagesToSave[RemainingIndex];
UE_LOG(LogTemp, Log, TEXT(“Cooking StandardFileName=%s Package=%s”), *StandardFileName.ToString(), *Package2->FileName.ToString());

After adding this line, when cooking I noticed something like :
“Cooking StandardFileName=None Package=Path/To/Map_BuiltData.uasset”
after deleting this file, I could successfully cook my project.