Is there any reason that the “find” node for maps in Blueprint only returns copies?
For many use cases changing the value directly is necessary, such as setting a member in a struct / vector / any other non-atomic type stored as a value for some key in a map variable. In the same way as there are “Get (Copy)” and “Get (Ref)” for TArrays.
Otherwise, an entirely new struct has to be created, and added with an “add” node, which is far from ideal. For one, it isn’t memory efficient, as the whole struct has to be constructed and saved somewhere else first. Also, it makes the blueprint graph less readable by cluttering it with unnecessary nodes, variables, sequences.
For example, some code like this will introduce no changes at all to “struct variable”, as it operates on the output of the “find” node, which seems to return a copy of the actual value:
It would be way better to be able to access the value directly. Is there some reason for that not to be possible?
Especially confusing why no such node exists since a non-const “find” exists in TMapBase.h in C++: