Target problem on a variable

Hello everyone.

I have a small problem because I created a variable of type boolean then I used this variable in another blueprint (that of my character). To use this variable and put a target. So I created a variable that references the blueprints of the original variable but there is an error message that appears. So I think the problem comes from the target because when I remove it, the problem disappeared.

Thank you very much for the help.

The setup shown in the blueprint image you provided is correct, however you need to set an instance of BP Pierre Violet from your level in order to use it. Without a direct link between that variable and a running instance of the BP in the level you will not be able to access that boolean.

If you only have 1 instance of the BP Pierre Violet in your level, create or find the Begin Play event in the blueprint shown in the image, drag out the white wire and add a GetAllActorsOfClass node. Set the class to your BP Pierre Violet blueprint, then from the output array drag out the wire and type Get and leave it set to index 0. Create a Set node for your BP Pierre Violet variable and attach the Get node output to the input on the variable and connect the execution wire.

This will force the blueprint to locate the BP Pierre Violet actor in your level and set it as the target, this will allow you to access that boolean variable.

The setup if you have multiple instances is a bit more complex, here’s the documentation explaining an alternate method (which can be used if you only have one in level also). As with most things in UE4 there are multiple ways to do it:

.unrealengine.com/en-us/Engine/Blueprints/UserGuide/BlueprintComms

as well as even more ways to do it:

.unrealengine.com/en-us/Engine/Blueprints/UserGuide/BlueprintCommsUsage

Hope that helps! Let me know if anything isn’t clear.