Blueprint components are able to be renamed to strings which are not valid object path names. If named improperly, MyComponent->GetPathName() will return an object path that will fail FPackageName::IsValidObjectPath(PathName), when a properly named object would otherwise have been successful.

The example that raised this issue was a static mesh component triggering a call to UE_ASSET_LOG. This component had a space in the name, which caused the UE_ASSET_LOG macro to assert due to a bad path name.

In this particular case, the breakdown also leads to a red herring error message

Illegal call to DoesPackageExist: '/Game/Maps/MapName.MapName:PersistentLevel.ActorName.ComponentName' is not a standard unreal filename or a long path name. Reason: Path should be no less than 4 characters long.

The reason for this is that FPackageName::DoesPackageExist calls FPackageName::TryConvertFilenameToLongPackageName. If that fails, it emits the above error message, but it provides the out-Arg from TryConvertFilenameToLongPackageName, not the original path input. Since it failed, the out-arg is an empty string and the error message erroneously concludes the cause to be path under 4 characters long.

The Editor should enforce rules that require component/object names to comply with object path naming convention.

Please see UDN link for full context.

Steps to Reproduce

Create a C++ based component.

Add the following to the BeginPlay

UE_ASSET_LOG(Log, Warning, this, TEXT("Crash if 'this' is named poorly"));

Then save and compile.
Create a blueprint and add the component above to it. Rename the component such that the name contains a space character, such as "My Component"

Compile, save.

Place the actor in the level and press play. This should invoke the begin play on the C++ component, passing the invalid name to the UE_ASSET_LOG macro and cause an assertion.



Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-64827 in the post.

Login to Vote

ComponentGameplay - Blueprint
Affects Versions4.194.20
CreatedOct 4, 2018
UpdatedOct 18, 2018