I am new to Unreal Engine, and currently using 5.2.1.
I am not making a multiplayer game; just a simple Arkanoid clone with my own spin on it.
I have a prototype running, but I am trying to restructure my code, so they go in their proper places. I am using blueprints.
I have no use for the GameState, and moved code from my level blueprint to the Game Mode. However, I recently implemented an interface, so that a couple of actors will get deleted when passing through a trigger box, but I also want to send that signal to the GameMode so it will respawn one of them.
The thing is, in the GameMode, begin play works and spawns the ball. But when the ball passes through the trigger box, it does trigger the interface event in its own code, but won’t trigger it in the GameMode blueprint, where I also have the interface implemented. Will this only work in a GameState? I prefer not to jump through so many hoops, and like to keep things in one place.
I know it can be kind of confusing, but those things are meant to be separated. Here, take a look at the documentation for a rundown on the differences between State, Mode, and Instance.
I’ve read the documentation twice. It assumes that every one is making a multiplayer game, which isn’t the case. So I went ahead and created a new blueprint from GameStateBase, and put the code to spawn the ball there. It works. I am having the same issue, with my interface; it doesn’t fire inside the gamemode, nor the game state; only from the actor.
I had to go back to using a event dispatcher. For some reason, The GameState and GameMode does not receieve interface messages, even though you can implement the interface and events there. I don’t know if this is by design or a bug.
When the ball overlapped the trigger box, did you also call the interface event on the game mode?
Please provide screenshots of the blueprint code you’re using to call the function from the trigger and also the implementation in the Game Mode. It’ll really help to understand the issue.
After watching another video tutorial on the subject; I found out what the issue is. I assumed that sending a message was a 1 to many process. It isn’t; so, I had to get the array of actors that implemented the interface, then call the interface function message for each of them.