Blueprint Communication Problem

I have 2 BP and a vehicle, BP1 is referenced in BP2 as a Object Variable and works nicely, I can access from BP2 the variables in BP1.
The problem comes when I try to spawn BP2 from the vehicle using Spawn Actor From Class Node: I get the error: Accessed none ‘VariableName’ from node Construction Script in blueprint BP2.
What am I doing wrong?
Thanks in advance.

Is it really impossible to spawn from a character a blueprint that has another blueprint referenced in it?

Edit:
If it is really impossibile what should I use?

I believe that error message is trying to say that the ‘VariableName’ variable in your BP2 has not been set when you try to use it in the construction script. If ‘VariableName’ is of type BP1, are you sure you have spawned a BP1 and set ‘VariableName’ to that instance of BP1, before you try to use it?

If that’s not useful, it would help if you could post the construction script of BP2, since that’s where the error seems to be coming from :slight_smile:

Hello,
I’ve just try a multi blueprint to check. I got some troubles but found solutions. There is a Bp1 with 2 variables bool and int., a Bp2 with a variable bp1 which is set on event begin play (could be set in construction script too) and a function returning the values of bp1 variables, my character which spawns bp2 on “m” and an event hit in myprojectile which print Bp1 variables infos from Bp2. There is a bp1 set in the level before start.
2df32fb24f220d660973439e330f29421368b465.jpeg

Yeah I think I did it properly, today I’ve tried again in a simpler way.
Basically I created a BP1 with an INT variable in it and placed it in the level, then created BP2, added the variable reference to BP1 in it and the logic to print the INT variable in BP1 tied to ONBEGINPLAY event, placed BP2 in the level and chose the instance of BP1.
Then in the character event graph I linked to a key the spawning of BP2.

When I click PLAY I see the value of the INT variable from BP1 printed on screen, so the direct communication between BP1 and BP2 is working, but when I press the key to spawn BP2 it doesn’t print the value of the variable in BP1 but instead it just prints 0 and when I press Esc I get the error message. :frowning:
Thanks however.

Ok, now I’m not at the PC were UE is installed, I’ll get there ASAP. Thanks to you too Fen.

I think what’s happening here is that when you place BP2 in the level, and set it to point at BP1 in the level, you’re only doing that for that one instance of BP2. When you press a key to spawn BP2, you’ll also have to set the variable in this newly spawned BP2 instance to point at a BP1 instance. Maybe you’re already doing that, but I couldn’t tell for sure :slight_smile:

I think if the BP1 variable in BP2 is set to be editable and “expose on spawn”, then you should be able to pass in the instance of BP1 in the level to the newly spawned BP2’s. Or, you can do it Fen’s way since pictures are awesome!

I tried to expose on spawn and make it editable but it doesn’t work, it surely happens what you say: apparently you cannot reference BP1 in the details of a BP2 that hasn’t been placed in the level. :frowning:

I’ve tried to make it working but I’m facing some hurdles, maybe bacause of the different nature of what I’m trying to do.
Basically BP1 is a checkpoint system which is used to determine the position of the character in the world, then in the BP2 the position of the character is added to a spline which is built on the fly and there’s the logic for a mesh to use that as a path.
Finally BP2 is spawned through the character, a vehicle in this case.

Sorry, i was away last days. If i have some time i try that and come back if i can find a solution to help.

Edit : I wonder why you don’t simply set an overlapping box at start of your spline bp and use it as event launcher.

Edit 2 : I found this one i did to have character moving on spline when overlapping a box, it needs a bit adaptation (especially controls lock) but it worked (mixamo_adam was set as character player) :

&d=1416484111

Got time to try this (the simple move to seems troubling now, i don’t know why, but the usual set location works). When i walk in, spline blueprint is spawned and i follow the spline. I added a box to have overlapping detect working.

Hi Fen thank you very much for your help, I’m rather busy too and I cannot be here as much as I would like to.
For what I can understand the character spawns the BP on an overlap event, but I can’t use this set up because my character is a vehicle moving along a track and the spawning of the custom projectile is started by the player.

The checkpoint system which is BP1 has an array made of the locations of the meshes I use to move a triggerbox to. When the vehicle overlaps the triggerbox a counter is incremented by one so that the triggerbox can be moved to the next location got from the array, I just need to send the array and the value of the counter to BP2 (my custom projectile).

When BP2 is spawned by the vehicle the location of the mesh I use as a projectile is inserted in the array according to the counter and then the mesh is moved along the spline starting at the position of the newly inserted point.
I’m not great with english but I hope I explained myself in an understandable way.
The logic is actually working, to test it I used a temporary blueprint where I put the global variables but I know this way is not appropriate.
How can I do this?
I don’t want to abuse your kindness and your spare time but I really can’t figure it out how to pass those data successfully.

I can’t get this working.
Maybe I’m missing something, I don’t know.
It’s literally weeks I’m banging my head on the wall to find a way to make it working.

Why don’t you simply use a reference (needed to be set with specific trigger on start) and directly cast to bp1 and drag infos from it on bp2 spawn ?