- Home /
UNET: Flicker when a client moves a non-player object using another non-player-object
First of all:
Unitypackage included
Demo video on https://youtu.be/uW3e2g6tabk
In a multiplayer game I need to synchronize the position, orientation, size (transform components) of many non-player game objects over network. Every client can move objects on mouse drag. The transform components are synchronized on all clients. (In this case the player position is not important, because there is no visible player, just the non-player objects' transform components).
Until this point it works fine.
But when a client moves an object on mouse drag and pushes another object whose position is also synchronized all over the network, there is a terrible flicker. Please see the video (link above). However, when you push a non-player object with another non-player object on the host instance of the network game there are no flickers. The movement is smooth then. But most of the time the connected clients do the game interactions. So how can I realize a smooth movement also when a client interacts as described above?
Note: I attached a custom PlayerAuthority script to the player prefab so that each client is able to move objects on mousedrag. Maybe I should also remove the host's authority to update the transform components to avoid conflicts? However I don´t know how it works and if this helps.
Any help would be appreciated. Thank you in advance!
Using UNET I made this example as follows:
An empty game object called NetworkManager owns the NetworkManager component. In the slot Spawn Info / Player Unity expects a prefab for each client which connects to the host.
The expected Player prefab (in my case called Player6 and located in Resources / Prefabs) contains a NetworkIdentity component (with Local player authority selected), a NetworkTransform component and a custom PlayerAuthority script which allows any client to move non-player objects (so not only the host can interact with the non-player objects).
Each non-player object whose transform components are synchronized all over the network contains a NetworkIdentity component, a NetworkTransform component, a custom DraggableXZ script for moving objects on mouse drag, and of course a Rigidbody and a collider.
Answer by RicoCruz · Apr 11, 2020 at 10:29 PM
I know I am almost 3 years late but I have the exact same problem right now. Do you have a solution by now?