Download

Spawn Blueprints 2x in World - Only the "first" can handle

Hello, everyone,

I think that’s probably a simple question, but still I can’t get the solution right now …
I have an Actor Blueprint and I spawn it into the world.
This is a flashlight that can be picked up by the character. Everything works well so far.
But as soon as I put the same blueprint into the world twice and want to take the 2nd, the first disappears …

I’ve had the same thing before, but unfortunately I don’t know what the solution was … I know, i’m still at the very beginning of learning blueprints.

It’s a Singleplayer Game.

Here is the Flashlight Blueprint…

thanks in advance

best regards

The interact script should be in the player, not in the flashlight. Input should be handled by the player, not by the flashlight. The whole idea is that the player looks / clicks / points at something and interacts with it.

This is a flashlight that can be picked up by the character

How do you intend on doing this? Click? Be close enough and press E to collect? UI element pops up and we scoop da loot?

Okay that makes sense.

I am currently doing this with a LineTraceOfChannel with a distance of 300 to the object.

When the LineTraceOfChannel event reaches the flashlight, I set a Boolean value that says that the flashlight is in focus. I then call up this Boolean value in the flashlight.
The CustomEvent “Client Scanning for Items” is a preparation for a possible switch to multiplayer :wink:

See screenshots.

Can you give me an example of how I roughly set up the whole thing in the Player Blueprint.

Thanks a lot


A quick question. Will you be picking just a flashlight or other items too?

In any case, other objects as well. But not all should be destroyed when taken.

How to approach things would really depend on the scope.

  • I’d start by creating an enumerator for the items and a blueprint interface for communication; add a function that returns that enum:

  • the Flashlight is implementing the interface, and the function returns the object type (don’t forget to set the enum):

  • so the player can interact with things in a very generic way:

Now each item class can handle the function the way you need.


Admittedly, there’s more than one way to set this up. But that’s the gist.

The method you mentioned works great and is definitely the right one for what I want to do.

Thank you so much for your effort.

1 Like