UNET Sync transfrom from client to server
Hi! When i move an obj on the server, it moves on the clients. But, when i move it on the clients, it does not move on the server. How do i fix this? I have the object as a prefab with the Network Identity script, Local Player Authority checked, and a Network Transfrom script on it set to Sync Transform.
Answer by wdjones · Jul 08, 2016 at 07:58 PM
In order to move an object (that isn't your player object) with the client, you will either need to give the client authority over the object(with the server) or tell the server that you want it moved through a Command attribute.
Authority can be done with a spawned object by calling NetworkIdentity.AssignClientAuthority on it or spawn the object with NetworkServer.SpawnWithClientAuthority.
This is briefly touched on at : http://docs.unity3d.com/530/Documentation/Manual/UNetSpawning.html
And mentioned again half way down the page at: http://docs.unity3d.com/530/Documentation/Manual/UNetActions.html
Your other method is using a Command Attribute from the client to call back to the server.
I would also highly recommend thoroughly reading through the Unet Manual start to finish to get a full understanding of what is required.
Your answer
![](https://koobas.hobune.stream/wayback/20220612070146im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
[UNET] Network Transform doesnt work for the host. On Client it works seemless. 0 Answers
Unity 5 Unet Network Rigidbody Syncing - Client sinking through objects. 0 Answers
[UNET] Transform sycing problem,[UNET] TRANSFORMATION SYCING PROBLEMS 0 Answers
Transform Position Are Different Each Other 1 Answer
Network Transport Layer API does not work with iOS to PC???? 0 Answers