Hi! I’m having an issue getting multiple actors to trigger the same event in a level blueprint.
This is a VR project and in my level I have many snowball actors that I can throw at a target. I have a variable in my level blueprint that counts when the snowball hits the target. When the target it hit, the OnActorHit for that target is triggered in my level blueprint and the score is increased by 1.
In addition to having the number of “hits” counted, I also need to count the total number of snowballs actually thrown so that I know how many are missed. The snowball actor blueprints are each able to detect when they are thrown (so they can play a “whoosh” sound). Every time a snowball is thrown, I want that snowball to increase the “thrown” variable in my level blueprint by 1.
I’ve looked into Event Dispatchers, but they seem like they are used when a single blueprint needs to talk to many other blueprints, but not when many blueprints need to talk to a single blueprint like in my case.
How would I accomplish what I’m trying to do?
Instead of using the level blueprint, which can be a pain to communicate with, I would use a custom Game Mode. The game mode can be accessed from almost any blueprint. To communicate with the Game Mode, I would use Get Game Mode and Cast to the specific type of game mode. Or even better, I would look into using Interface Blueprints.
If you don’t know, Interface Blueprints are amazing tools that allow a bunch of different blueprints communicate with a single blueprint, or a single blueprint communicating with a bunch of different types of blueprints.
Ok, I will give that a shot and see if I can get it working. Thank you.
I tried using a blueprint interface to communicate with the level blueprint but for the life of me I could not get it to work. Does the level blueprint intentionally impose limitations, and is it even compatible with a BPI? Is it generally a bad spot to store gameplay-related variables? I’ve seen tutorials where these type of variables are placed in the character blueprint. Is this generally a good practice or am I better off storing those types of variables in a custom Game Mode?
I’m fairly new to UE4 so naturally I have so many questions!