Spawning two actors in succession and while they are each others' variables

That question is probably quite convoluted, but what I’m essentially trying to do, is make a throwable teleport. So first press of a key you throw the Sender and on the second press you throw the Receiver (those are just names of the blueprints, the actual thing is two way). I also want to have the first one off, before the second one is placed (variable “SenderIsActive”).

My current setup is this:

I want to be able to use the “receiver” as target for the “sender” and set the “SenderIsActive” active to true (it’s default value upon spawn is false) when I place my receiver. Obviously just pulling them in as nodes doesn’t work, because when the Sender is spawned the receiver doesn’t exist. How do I input such a flow control, that I would be able to do this?

  1. Make A variable that diferencies between two, like you did. “SenderIsActive”.
  2. Each time you trigger the button, Using “Get all actors of Class” node, check if length is 0, 1, or 2. 0, if You dont have no one, 1 You Create “Target”, and 2 you get destination.
  3. Make a Switch Int on this length, then apply your logic to set “sender on/off”

I don’t know if I understood you right, but I think this might not work. They are different classes already you see so it’s not possible to use “Get all actors of Class”.

I was able to solve this, but with a not so nice solution. It also gives me a warning on compile…

I added a “Cast to TeleportSender_Blueprint” that use the actor as its object. Then as TeleportSender Blueprint makes the sender active and sets the target receiver.

It works though.