Description

When adding new elements to a Map in blueprints it will return the error "Cannot add a new key to the map while a key with the default value exists". This is because it currently won't increment the default value when adding a new key.

The easy workaround is to just edit the default key and then it will be able to add another element. It would be more intuitive if it automatically incremented the default key value though.

Steps to Reproduce
  1. Open any project
  2. Create a new actor Blueprint
  3. Open the BP and create a new int variable
  4. Click the Icon next to the Variable Type and select "Map (dictionary)" from the dropdown
  5. Compile then try to add additional elements to the default value

RESULT
You get an error message "Cannot add a new key to the map while a key with the default value exists"

EXPECTED
A new element gets added that has a key that is incremented from the default value. e.g. If the default INT is 0 when you add another element the next key is automatically set to 1 then 2 etc...

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

87
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.154.20
CreatedFeb 13, 2017
ResolvedAug 18, 2021
UpdatedAug 7, 2023
View Jira Issue