On component begin overlap triggered on all actors (mutliplayer)

Hello,
I am trying to use on component begin overlap when one player walks on a gem but the event is triggered for all the actors and I don’t understand why. Can you tell me why ?

Here is the event:

And here is how the actors are spawned:

Thanks

Hello Songe08!

AGameModeBase::HandleStartingNewPlayer | Unreal Engine Documentation

According to the documentation, HandleStartingNewPlayer is to signal the game instance that a new player is ready to enter the game. I get that you want to store a reference to the newly joined player’s PlayerController in your Player Controller array. But why are you running a for each loop on the Player Controllers array, every single time a new player joins? What you would want to do is, just spawn a new pawn for the newly joined player’s PlayerController and then make it posses that pawn. Not spawn a Pawn again and again (every time a new player joins) for every single player out there and then have them possess it.

As far as I understand, your problem stems from this fact.

Begin overlap get called by all actors

If you want to run the code only from the character
You can cast it to the character

So if it gets called by actor (other than character) the cast will fail

Just use cast node of your character instead of is valid

Hope this helps

1 Like

Hello,

@8Zerocool8
I followed a tutorial :slight_smile:
As far as I understand, the “for” will be executed when all player will be ready.

@Kunal.Sni
Thanks, I will check

For now it is working when I use “is local controller”