in my project I have placed 2 characters. You can select and move them. I play with 2 players (Server and Client 1) and the goal is that every player can take ownership of a character when clicking on it. This should only work if the character doesn’t have an owner yet. I bet there’s an easy way I just don’t see. I tried this:
I added a variable to the characters that stores a PlayerController.
The PlayerController handles clicking on a character. If the owner-Variable is invalid, it will be set to a reference of itself. Now I can select a character, take ownership and then check if the owner is equal to the PlayerController and move it around (or do nothing otherwise).
My problem is that this only works on the Server. If you click a character, Client 1 says it has an invalid owner and takes ownership, even if the Server has done this before. After that it claims this PlayerController-Instance is not equal to the stored one and I just don’t know why.
LogBlueprintUserMessages: [PlayerController_C_0] Server: PlayerController_C_0 owns Unit2_233
LogBlueprintUserMessages: [PlayerController_C_0] Server: PlayerController_C_0 owns Unit_214
LogBlueprintUserMessages: [PlayerController_C_0] Client 1: PlayerController_C_0 owns Unit2_233
LogBlueprintUserMessages: [PlayerController_C_0] Client 1: PlayerController_C_0 owns Unit_214
OwnedBy and SelectedUnit are both replicated. Isn’t Client 1 supposed to use PlayerController_C_1?
Thanks in advance!