I’d like to achieve the following:
In Blueprint 1, a series of nodes should fire when an object that is part of Blueprint 2 is clicked in the scene.
For example: There is a cube in the scene (which is actually part of BP 2). When I click this cube, then a cone in the scene (which is part of BP 1) should move and then rotate.
How do I communicate between the two blueprints? Can anybody point me to the right direction?
In BP_Cube1 you could have a reference variable of BP_Cube2. To save on casting etc you could manually set this variable to the BP_Cube2 actor in the world using the eye-dropper and clicking on actor BP_Cube2 in your scene.
Next you would setup a Blueprint interface called something like BPI_Cube2_DoStuff. In here you would make a function called MoveThenRotate.
Add this Blueprint interface to the BP_Cube2 blueprint.
Then you would make an OnClicked event in BP_Cube1 linked either to its StaticMesh component or a trigger box etc.
Call the event MoveThenRotate (BPI_Cube2_DoStuff message) and link it to your OnClicked event then link the target of the event to your BP_Cube2 reference variable.
Back in BP_Cube2 in the events graph call the actual event MoveThenRotate. And add your movement logic etc to it.
So now, you should be able to click on cube1 and it will send a message to cube2 and it will execute the logic you setup.
Geepers I hope that all makes sense. If not yell out. I wrote it in one go. Anyway I hope that helps in someway. There are quite a few ways you could do this, but yea.
Created a variable manually in ‘BP Two’ that has the Variable Type set to ‘BP One’.
Created a Custom Event in ‘BP One’ that is going into the logic set up there.
When ‘BP Two’ is clicked it is calling the Custom Event logic set up in ‘BP One’. (The ‘BP One’ reference variable goes int the target here)
And the custom event logic in ‘BP One’ is not executed.
It says: ’ Accessed none trying to read property “BP One reference variable name here”. ’ Blueprint: BP two.