Download

Use spawned actors in another blueprint (global variables?)

Hi everyone!
Right now I am trying to build a VR kitchen level in UE 4.17 and I want to use some blueprints to do the following:

First I start the level and some portions of raw rye dough and raw wheat dough are spawned on the table in front of me.
I can grab one of the portions with the motion controller (HTC Vive) and go to an oven with it.
When I overlap the collision box of the oven (which is in the oven blueprint), the raw dough is deleted and some bread is spawned in the oven (this command is also in the oven blueprint).
Then I want to grab the bread, bring it to a slicer (with an own collision box) and the bread will be deleted there and five slices of bread are spawned next to the slicer.

So far I can spawn the dough via blueprint, grab it and carry it to the oven.
But in the oven I can only delete dough, if I put some in its blueprint. However I want every (spawned) portion of dough in the level to be able to interact with the oven and slicer and be destroyed there.
I already read that I maybe need “global variables” or something like that but could not find good instructions for this online.
After this the slicer shall also be able to interact with the bread, which I spawned in the oven blueprint before.
If possible I want to program this in the machine‘s blueprints and not in the level blueprint, so that I can copy an oven and all of its other funtions are copied with it as well.

This is my blueprint so far.

As already said: it works, but it only works with rye1 or wheat1 (highlighted yellow) which are placed in the oven blueprint and not with every portion of dough in the level. The blueprint for the slicer looks similar.
(The Branch is just for: if wheat dough, create wheat bread and if rye dough, create rye bread.)

So: how can I adress a spawned actor in every blueprint in the level?

Thanks for answers!

(I am native German. Ask me, if I explained something too poorly. :wink: )