I have a Location Marker that is supposed to help the players with finding the right path. So every Player needs to set its Position individually.
This is the Code to place the Marker. It works fine on the Server but if I run it on Clients I get null references for the Particles.
This is where I reference the Marker(Particle) . Its inside the Player Controller.
So my Question is. How do I get this to work on clients? I really dont understand what I’m doing wrong here.
No it doesn’t.
The Problem is that the Clients dont know the Objective Marker. If I validate that won’t fix the Issue.
Using Replication on the Markers will show all markers to all players. And thats not what i’m looking for.
use IsValid node before using a reverence, and replicate the marker particle variable. Does that help?
I am guessing you are using a “Has Authority” node, when the server does stuff.
Well when “Has Authority” == true → server, AND “Has Authority” == false → client
So an option is for the client side stuff, check “Has Authority”, if false spawn on client AND store the reference in a non-replicated variable.
Couldnt make it work like that. I’m pretty sure I misunderstood the way Player Controllers work on the Network and thats the main reason why I’m stuck here. No idea where to read it up though since the documentation is kinda poor.
Okay so double checking: you can get it to spawn on the server and then all clients can see it, correct?
So, I am guessing you are putting all the points into an array (so you can add them for each connected client) - so then when each client connects, give the client an ID, and then the client ONLY displays the element in the array that pertains to their ID - maybe NOT the best solution, but…
I had to change my code a bit but now i got it working properly the way I intended. Thanks for the suggestions anyways
There were two things I had to Change.
- Instead of spawning the Marker on the Player Pawn, I now spawn it on the Player Controller. And I check if the player has the ID to make sure I get the local one.
- Some of the null reference errors occured on the client side, because on default they dont have access to the navigation. And that leads to Errors in the Find Path Node. But there is an option to turn client side navigation on. And now everything works fine