本文介绍了Unity [UNET]同步非玩家对象转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对UNET系统有疑问.

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.

对象的NetworkIdentity组件已选中LocalPlayerAuthority.它还具有NetworkTransform脚本,但是转换仅从主机到客户端同步,而没有相反的方式.因此,如果我在主机端移动对象,则所有客户端都会看到更改,但是如果客户端移动了该对象,则只有该特定客户端才能看到更改.我该怎么做才能使其在两侧同步?

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?

推荐答案

没关系,我已经解决了这个问题.

Never mind, I already solved this problem.

我要做的是通过使用玩家对象来AssignLocalAuthority非玩家对象.

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

这篇关于Unity [UNET]同步非玩家对象转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 22:34