Get target of a variable from another Blueprint

Hello there.

I’ve been using Unreal for some days already and I’m getting used to Blueprints, but I’m having a problem that even by doing my own research I couldn’t solve.

So, I spawned two cubes, with two different blueprints:
Cube 1: The blueprint gets the location and rotation of the mesh and stores the vector and rotator in a variable.
Cube 2: The blueprint tries to get the location (vectorloc) and the rotation (rotloc) variables from Cube 1 and sets the location and rotation of Cube 2 according to the variables.

Basically, what I want to do is to set the same rotation of a cube to another and set an offset between them.

The problem is that when I get the variables, the node asks me for a target, self references don’t work, I’ve tried casting to Cube 1 but then it asks me for an object, and I don’t know what to put in there.
What should I do?

Hello MadnessReloaded

You need to tell the engine what blueprint to get the variables from. This is done with ‘references’!

Here an example:

  1. Create a new variable
  2. Click on the variable type dropdown and type in the name of the blueprint you want to communicate with.
  3. Choose ‘reference’
  4. Click on ‘Editable’ to make the variable public.

Select cube 2 in the level editor and choose cube1 in the dropdown menu indicated by the blue number 5:

125094-bpcom2.png

In Cube2, drag the Cube1Ref variable into the blueprint editor and choose get. Drag a blue wire out from the pin on Cube1Ref and type Vectorloc in the search field. You should be able to find it there and the variable should look like this:

125095-bpcom3.png

Quick and dirty explanation, but I hope it helps!

Wow, thank you so much! It works perfectly now.

Can you click on ‘Accept answer’ so that this question is marked as Resolved? It is at the top of the answer under the upvote/downvote thingy.

Thank you!

Done! Thank you

I know this is like 101 stuff, but Thank you so much! haha. I just spent an hour trying to solve this as a beginner with programming and BP.