Question about BP instances and passing variables

So, i’ve got the passing variables between blueprints down i’m pretty sure. Create your object reference, set it public, choose your instance.

What about when I have a ‘master’ BP that automatically creates instances of another BP? I can’t select any of the instances in the world outliner (it just moves my selection to the parent) and my object reference is null. In the interest of not having one giant BP, is there a way I can get them talking to each other?

A picture would be great. Are you saying you have a master BP say of the actor class that spawns actors or creates an array of classes or?

You can cast, reference vars, level BP references, interfaces, lots of ways to communicate.

Hopefully this screen can explain what’s going on

The spline BP called trackGen (the ‘master/parent’) is adding child instances of the cube_phase0_bp. The goal is tower defense mechanics, with the enemy traveling along the spline. I need to be able to communicate with each individual instance to see what state it’s at and whatever other stuff I need.

That’s where i’m running into my problem. If I try and select the children in the world outliner it just automatically selects the spline (the parent). This is with trying to make an object reference variable to them.

I’m no stranger to scripting but this is my first dive into blueprints so there is probably a better way to do what I want, maybe :wink:

The attachment from your post does not work.

I had a similar problem. I had to create and attach blueprint actors to my character and set its variables from the editor. Unfortunately, like you said, can’t select these “child” actors themselves. So had to go and create a Blueprint Structure for each of these added blueprint actors, make a variable of these structures and make them public. Finally my character passes on the information from these public structures to my blueprint actors. All of this to just basically expose my child blueprint actor’s variables and edit them in the editor.

So in short, I don’t have an answer, but hopefully someone will come along with one and make our lives easier!

derp,

the Add Child Actor Component node from blueprints has a return Value, which will be the new Actor you just spawned, this is your reference, if you need this actor to do something you can cast to the child blueprint and you will have all functions variables etc right there, if you need to use it later for whatever reason, you can also store them in an array. Accessing them then also becomes easy if you want them all to do something you can do foreach in array, if you want a specific one to do something you can “get from array” etc. procedural generated actors like this need just a little bit more work, but in the end it gives you alot more control and a cleaner blueprint as well.

but you should probably see what the reason is that you need them to be editable in the editor for anyway, if it’s just for blueprint communication, you don’t need them to be editable in the editor at all, you can do that with the Return Value from Add Child Actor Component.

yessssss, it lives!!!

I added them to an array from the add actor node, then in the event graph I do a for each loop through the array and pull out the variable I need from each one and print it out. As a test for now.

Thanks for breaking me out of my stump :slight_smile: