Reference actor A that spawned actor B from actor B

Just as the title says, is it possible to reference actor A that spawned actor B from within the event graph/ construction script of actor B.

In my specific case: based on the rotation of actor A I’d like to set the linear velocity of actor B.

A will be changing throughout the level, and actors C, and D will also be spawning B

You can create a variable and make it editable and expose it on spawn.

Technically your still referencing it in actor A but it’s just another pin and since you provide an actor reference it will update with the original actor.

The same variable can then be set from any actor… Any node which spawns it. It should work like you want it if I understood it correctly.

I hope this helps.


Like Erasio just said, if you make a variable on Actor B and expose it on spawn, then pass it Actor A as you spawn Actor B, Actor B will spawn with a reference to Actor A in that variable.

But what do you mean by “Actor A will change throughout the level” ?

Do you mean that you want to update Actor B’s reference to whoever Actor A is to a “new” Actor A?

If so it sounds like you should have a variable referencing Actor A in your GameState (or somewhere that is more globally accessible) and then have Actor B look at that variable whenever you need to update it, instead of having the reference on Actor B itself.

Actor A will change throughout the level"
When I say this, I mean there will be multiple copies of A Throughout the level, each spawning their own B

Would the way to accomplish this still be the same? I was kind of confused by your explanation.

That should be easy then.

  1. On Actor B, create a variable of the type Actor A and make it editable and expose on spawn. This will allow you to change that variable on the ‘spawn actor’ node if you select Actor B as the class to spawn.


  1. On Actor A, spawn Actor B using a SpawnActor node and pass a reference to self (aka Actor A) to the Actor A variable.


1 Like