Packaged project, unwarranted log spam from physics engine with procedural components

Any project using WITH_RUNTIME_PHYSICS_COOKING and creating collision for a component will cause physics log spam in packaged builds when creating the collision due to the following section in BodySetup.cpp:

(This also applies to the built in procedural mesh component and its Blueprint library)

#if WITH_PHYSX
	if (!bContainedData)
	{
		if (FPlatformProperties::RequiresCookedData())
		{
			UE_LOG(LogPhysics, Error, TEXT("Attempt to build physics data for %s when we are unable to. This platform requires cooked packages."), *GetPathName());
		}

		if (AggGeom.ConvexElems.Num() == 0 && (CDP == NULL || CDP->ContainsPhysicsTriMeshData(bMeshCollideAll) == false))
		{
			return NULL;
		}

#if WITH_RUNTIME_PHYSICS_COOKING || WITH_EDITOR

This shouldn’t be the correct behavior, FPlatformProperties::RequiresCookedData() returns True for ALL platforms when its not an editor build, even ones that support WITH_RUNTIME_PHYSICS_COOKING. So platforms that allow runtime cooking will throw the error into the log and then go forward and still cook the collision anyway. For every procedural mesh update the log will show another entry with this error message but will do what the error is saying can’t be done anyway without issue.

Note This doesn’t show up in WITH_EDITOR builds as for windows it declares:

static FORCEINLINE bool RequiresCookedData()
{
	return !HAS_EDITOR_DATA;
}

I was unsure about the reasoning here for the message and why it is coupled to FPlatformProperties so I did not make this a pull request.

Either the error shouldn’t be shown when WITH_RUNTIME_PHYSICS_COOKING is declared, the error message should be removed entirely, or RequiresCookedData() is being declared/used incorrectly.

Hello mordentral,

Thank you for reporting this issue. As this seems to require a bit of project setup to get a reproduction of the problem, could you either provide steps for setting up the project or provide an example project that I could package and get the problem?

Wasn’t sure how you wanted the example, just uploaded to google drive:

The test just spawns a procedural mesh component for every press of “T”.

Thank you for the project. I see the problem and I’ve placed a bug report in for the issue. For reference, the bug number is UE-28331. I’ll let you know when any updates are made to the report.

Have a nice day!