I’m facing a lot of difficulty trying to have my blueprints communicate with each other. I use an event ticker (for testing) in the level blueprint that calls a custom event I made in the first person character. I added a variable to the level blueprint that contains the first person character (and it’s been made public). I dragged a reference of the first person character and tried to call the custom event through using the ticker, no luck.
first person character:
This works if the event tick is in the first person character, but something in the communication to the level blueprint is messing things up.
Next I tried event dispatchers, despite my little experience with them. Here’s what I made, it keeps getting the error : “Error Accessed None ‘FIRST PERSON CHARACTER’ from node Event Tick in blueprint FirstPersonExampleMap”
first person character:
This blueprint communication is really confusing me, help is very appreciated.
I think your issue is instantiation order, your level BP instance is generated before your character instance so when your level BP goes looking for the character on that first tick, it is not there yet. Have your character get the location from the level instead and do your moving in the character BP.
Or, create a function interface, set up the function to do your magic in the level BP but have the character request the execution.
Hey, well in general when you use several Blueprints to communicate between each other ,
it’s a good idea to use GameMode (c++ or a blueprint) that should handle the core gameplay stuff.
It’s the way engine is designed, but of course you can find your own way of doing it.
The point is only one GameMode exists at a time, so there’s no confusion.
Next try just using “SetActorLocation” node to set your character location.
And here is a screenshot of example of casting a GameMode reference to any other blueprints,
first create a newVariable and name it GameModeVariable, for type select “object” type - parent GameMode (c++ or a blueprint).
Then create nodes like in screenshot, first you get the game mode and cast it to your blueprint , then save(set) the reference to the variable in your new GameModeVariable.
Now you can put your new variable onto the event graph,
and when you click and drag of the pin , when you release the button, a window pops up,
and you have access to all the content of the GameMode class(c++ or blueprint).
You can use this method with any blueprints.
For example now you could go into the GameMode class and create a new variable myCharacterVar.
Then you could access this variable from all other blueprints that have reference to GameMode like this:
If for example you would have many characters in the game and would like to keep track of which one was clicked last you could just set up the click event on your character, and do:
onClick->GameModeVariable->myCharacterVar = this ; (= Self)
I tried your first suggestion. What I did was set up a trigger box to signal the player controller when anything overlaps it. I made it fire an event called “move please” which is defined in player controller. This does not work, the overlap part fires but the ‘move please’ event doesn’t fire in the player controller.
You’re welcome, I also want to point out you don’t really need to Cast the GameMode like that, since there’s only one GameMode , you can access it from all classes simply by BeginPlay->GetGameMode->Store reference to variable. However you do need the cast thing with other classes.
Thanks a lot! One more question, for some reason, communicating between the player controller and the game mode is giving blueprint (or me) a hard time. Everything seems to be cased correctly. I made sure that the world settings had the correct game mode. What’s going on?
Ok, I think the problem is with the sphere variables, I see you have Sphere variable in GameMode blueprint and in PlayerControler, but you only need one reference to your sphere. You can make this work as it is but rather simplify it by doing this:
You create a “SphereReference” variable (object type) in your GameMode blueprint.
You don’t need anything else in GameMode blueprint.
In your Sphere blueprint and your Player Controller blueprint you only need to get a reference to GameMode blueprint :
Ok, I think i followed your directions. For some reason it’s not working. Here’s a imgur album I tried using the “self” reference for the sphere, but it didn’t work. So I tried making another variable (that was a “sphere blueprint” and used the eye dropper tool to select the object in the scene in the defaults panel. This didn’t work either. I really appreciate your help, communication between blueprints is pretty annoying
Yes you’re almost there :), yes the SphereReference needs to be a variable object type of your SphereBlueprint, and the GameModeReference variables need to be a object type of your GameModeBlueprint. So recheck that.
Then actually this should work as it is, the EventGraph is correct.
I’ll check back tomorrow after work, Good Luck