Description

Certain Map container calls (e.g. Find, Add) will fail to compile at packaging time if a Blueprint class containing a Map variable with a user-defined enumeration as the key type is nativized.

This is similar to the issue described in UE-61275.

Suggested workaround: Change the key type from the UserDefinedEnum type to Byte, then fix up connections to existing Map container call nodes.

Steps to Reproduce
  1. Create a new (blank) Blueprint-only project.
  2. Create a new User-Defined Enumeration and add at least one entry. Save.
  3. Create a new Actor-based Blueprint class, double-click to open in the Blueprint editor.
  4. Add a new variable and change its container type to 'Map' with a key type of the User-Defined enumeration created above. The value type can remain as integer (default).
  5. Click over to the Event Graph tab and drag the map variable into the graph. Choose to create a "Get" node.
  6. Drag off the "Get" node and choose the "Find" function. Drag off the Key input pin and choose "Make a Literal NewUserDefinedEnum." Leave the default value as-is.
  7. Drag off the "Find" node's output pin and connect it to a PrintString node.
  8. Connect the PrintString node to the BeginPlay event.
  9. Compile and save the Blueprint class.
  10. In the project settings, change the Blueprint nativization method to "Inclusive."
  11. Choose File->Package Project->Windows->Win64 and wait for packaging to finish. An error will result:
UATHelper: Packaging (Windows (64-bit)):     D:\dev\UE4\Dev-Framework\Engine\Source\Runtime\Engine\Public\GeneratedCodeHelpers.h(427): error C2663: 'TMapBase<KeyType,ValueType,SetAllocator,KeyFuncs>::Find': 2 overloads have no legal conversion for 'this' pointer
UATHelper: Packaging (Windows (64-bit)):             with
UATHelper: Packaging (Windows (64-bit)):             [
UATHelper: Packaging (Windows (64-bit)):                 KeyType=E__NewUserDefinedEnum__pf,
UATHelper: Packaging (Windows (64-bit)):                 ValueType=int32,
UATHelper: Packaging (Windows (64-bit)):                 SetAllocator=FDefaultSetAllocator,
UATHelper: Packaging (Windows (64-bit)):                 KeyFuncs=TDefaultMapHashableKeyFuncs<E__NewUserDefinedEnum__pf,int32,false>
UATHelper: Packaging (Windows (64-bit)):             ]
UATHelper: Packaging (Windows (64-bit)):     D:/dev/local/Projects/NatMapEnumKeyTest/Intermediate/Plugins/NativizedAssets/Windows/Game/Source/NativizedAssets/Private/NewBlueprint__pf1010915279.cpp(472): note: see reference to function template instantiation 'bool FCustomThunkTemplates::Map_Find<E__NewUserDefinedEnum__pf,int32,uint8,int32>(const TMap<E__NewUs
erDefinedEnum__pf,int32,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<KeyType,ValueType,false>> &,const V &,W &)' being compiled
UATHelper: Packaging (Windows (64-bit)):             with
UATHelper: Packaging (Windows (64-bit)):             [
UATHelper: Packaging (Windows (64-bit)):                 KeyType=E__NewUserDefinedEnum__pf,
UATHelper: Packaging (Windows (64-bit)):                 ValueType=int32,
UATHelper: Packaging (Windows (64-bit)):                 V=uint8,
UATHelper: Packaging (Windows (64-bit)):                 W=int32
UATHelper: Packaging (Windows (64-bit)):             ]

Have Comments or More Details?

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

1
Login to Vote

Unresolved
ComponentGameplay - Blueprint
Affects Versions4.204.214.224.23
CreatedJun 17, 2019
UpdatedJul 27, 2019