Change visual state on received event in multiplayer
let me describe the context:
I have a multiplayer sports game, with a ball. This ball declares an event, when it's owner changes.
Each character in the game owns a DecalComponent, which renders a colored circle on the floor. I created an instance material, so I can dynamically change the color of this circle, depending if the player has the ball in his hands or not. In the BeginPlay event, I make the character register to the event on the ball, and this is where the modification of the color of the decal happens.
In every case, the owner changed event is always correctly broadcated to every character in the game.
Again, when I put a breakpoint in visual studio in ABBCharacter::OnBallOwnerChanged, it is triggered for every client, and I can see the code is actually correctly called. It's just that visually, the decals still have the same color.
You can find below all the relevant code used for this case.
Thanks in advance
asked Apr 06 '14 at 09:36 AM in C++ Programming
I found the error . If I have 2 players connected to a dedicated server, I only got the breakpoint 2 times, on the server.
What I did then was to use a boolean ItHasBall, which is replicated, and which I set in the OnBallOwnerChanged function of ABBCharacter.
And now it works :) (for now)
answered Apr 06 '14 at 07:25 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here