Hello everyone !
I’m trying to move a unit on a client and it’s not working, while working perfectly fine on the server.
So my RTS Pawn has an array of selected actors, and will call the RPC for every single one of the unit (yeah, I know this is weird, I’m gonna change it but still). I use a BlueprintNativeEvent to link my C++ class with the BP child of that class (I use BP mostly for the viewport that C++ doesn’t have T_T).
// Called to move units
void ACommander::RightMouseReleased() {
for (AActor* actor : selectedActors) {
if(actor->IsA(AFrench_TestInfantry::StaticClass())) {
Cast<AFrench_TestInfantry>(actor)->MoveUnit(FVector(0, 0, 0));
}
}
}
And inside my BP, I do that :
This is only working if the server uses it. If the client try to call it, it won’t even call the “ROS Moving Unit”. So the RPC is not even called. Instead, only the “BEFORE ROS” is printed.
My infantries are Characters set to replicates & movement replicates. When a unit is moving, both clients & server can see it.
My guess is that it’s coming from ownership, but I’m really not certain how to fix it. The Barrack is supposed to have the right owner (my commander) and give it to the infantry on creation.
Thanks !