- Home /
Help needed on UNET client authority
I am working on an RTS-type game where each player controls multiple characters each round. Using UNET, I have created an abstract player object which is spawned when a new player joins the game, attached to which is a script that handles spawning and controlling each player's characters.
Initially, I was simply using NetworkServer.Spawn(object) without authority, and using commands in order for each client to move its characters. However, due to network latency, I realized I needed to implement client-side prediction.
I am now calling NetworkServer.SpawnWithNetworkAuthority(object, connectionToClient) within a Command, and the objects are spawning correctly. However, I am having trouble getting the correct movement for the characters. I need to be able to move the local client's copy of the character gameobject immediately when input is received, a problem for which I believe client authority is the solution. However, even though the characters have their authority set, they do not move at all when I try to update their transform.position. I have also tried creating a Move() function inside a script on the character prefab, which is called from the UNET 'Player' object. Neither solution is working to move the characters.
I have tried about everything I can think of (much more than I have listed), and cannot figure out how to solve this issue. Maybe I am going about this the wrong way. I have found resources related to client-side prediction, but for when the UNET Player object is a controllable character, not an abstract player object controlling multiple spawned gameobjects, as in my case.
Any help would be greatly appreciated. Thanks!
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Custom network ID values 0 Answers
Network client : cannot fire 0 Answers
Multiplayer Networking 1 Answer
Sequencing Spawning for Multiplayer 1 Answer