I am making a procedurally generated house with locked doors and keys. To do this I use a Spawn Actor on a Key BP to spawn however many Key BP Children I need. These keys have a simple overlap → input → pickup (destroy actor). When I run the code and pickup one key, all the other children in the level are destroyed as well. What can I do to fix this? Thanks in advance!
You’ll want to post some code for people to analyze. The process of how you’re spawning and destroying sounds correct but maybe the code execution has a quirk to it.
Here is a link to the code.
The only that that would be the same for all instances is the input key no? So unless there is some error we are missing the “on begin overlap” is probably fired from interacting with some other actor in your scene that has overlap enabled. I don’t know your layout but make sure no other actor that is potentially overlapping your keys is setting of the “on begin overlap”.
You can very easily check this by tying a print string node to it and geting the display name from the other actor node.
Simple solution would be to make a cast to your “player actor” after the begin overlap to make sure that specific actor type is the one overlapping you key, or reversing the problem by firing the event from the “player” actor instead, (on begin overlap key actor etc).