Unity [UNET] Sync non-player object transform

2019-07-25 13:30发布

问题:

I have a question regarding the UNET system.

There are some objects in the scene that can be picked. I want to synchronize transform that object when a player picks it up.

The object has a NetworkIdentity component with LocalPlayerAuthority checked. It also has a NetworkTransform script, but the transform synchronizes only from host to clients, not the other way around. So if I move the object on the host side all clients see the change, but if the client moves it only that particular client sees the change. What do I need to do in order to make it synchronized on both sides?

回答1:

Never mind, I already solved this problem.

What I had to do is to AssignLocalAuthority of the non-player object by using player object.