刷新道具的蓝图写在了道具本身里,复制开了,专门弄了个在服务器上运行的事件后面连上刷新道具的函数,可总是刷新位置不一致甚至不刷新
5条回答 默认 最新
关注让 “紫雾凌寒” 来帮你回答,本回答结合 DeepSeek
如果还有问题,请评论或点击头像私信,如果有帮助到您, 请关注、采纳、点赞
- 关键点分析:
- 核心问题在于UE5.5使用Steam联机时,道具刷新位置同步出现问题。
- 虽然在服务器上运行了刷新道具的函数,但位置不一致甚至不刷新,可能涉及到网络同步机制、复制设置以及相关变量的同步问题。 - 解决方案:
- 确保复制设置正确:- 在道具蓝图中,检查“Replication”(复制)相关设置。确保该道具具有正确的“Replicate Movement”(复制移动)和“Replicate On Server”(在服务器上复制)等设置。通常这些选项应设置为开启状态。
- 同步位置变量:
- 如果道具的位置是通过变量控制刷新的,要确保这些变量在服务器和客户端之间正确同步。
- 例如,假设道具蓝图中有一个“Location”变量用于控制刷新位置。
- 在服务器上设置位置变量时,要使用可靠的网络操作,如:
// 在服务器上设置道具位置 SetActorLocation(DesiredLocation, true);- 这里的`true`表示这是一个可靠的位置更新。对于客户端,要确保能正确接收服务器设置的位置变量更新。可以通过在道具蓝图中添加网络同步代码,如:```
// 在道具蓝图的事件图表中
if (HasAuthority())
{
// 服务器设置位置的代码
}
else
{
// 客户端接收位置更新的代码,例如通过网络通知或事件
// 假设通过自定义网络通知“UpdatePropLocation”
FNetworkNotifyParams NotifyParams;
NotifyParams.bReliable = true;
NotifyParams.ExecutionOrder = 0;
NotifyParams.bMulticast = false;
NotifyParams.bLocalUserOnly = false;
NotifyParams.bServer = true;
NotifyParams.bClient = true;
NotifyParams.bSimulated = true;
NotifyParams.bReplicate = true;
NotifyParams.bRemote = true;
NotifyParams.bInLocalRange = true;
NotifyParams.bInGlobalRange = true;
NotifyParams.bInReliableRange = true;
NotifyParams.bInUnreliableRange = false;
NotifyParams.bInGuaranteedRange = false;
NotifyParams.bInLocalInvocation = false;
NotifyParams.bInRemoteInvocation = false;
NotifyParams.bInClientSimulation = true;
NotifyParams.bInServerSimulation = true;
NotifyParams.bInSimulatedProxy = true;
NotifyParams.bInOwnerOnly = false;
NotifyParams.bInAutonomousProxy = true;
NotifyParams.bInPredictionWindow = false;
NotifyParams.bInSpatializationWindow = false;
NotifyParams.bInSpatialization = false;
NotifyParams.bInServerOnly = false;
NotifyParams.bInClientOnly = false;
NotifyParams.bInSimulatedOnly = false;
NotifyParams.bInReplicatedOnly = true;
NotifyParams.bInOwnerReplicatedOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnly = false;
NotifyParams.bInServerReplicatedOnly = false;
NotifyParams.bInClientReplicatedOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnly = false;
NotifyParams.bInLocalPlayerOnly = false;
NotifyParams.bInRemotePlayerOnly = false;
NotifyParams.bInOwnerPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerPlayerOnly = false;
NotifyParams.bInClientPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInLocalRangePlayerOnly = false;
NotifyParams.bInGlobalRangePlayerOnly = false;
NotifyParams.bInReliableRangePlayerOnly = false;
NotifyParams.bInUnreliableRangePlayerOnly = false;
NotifyParams.bInGuaranteedRangePlayerOnly = false;
NotifyParams.bInLocalInvocationPlayerOnly = false;
NotifyParams.bInRemoteInvocationPlayerOnly = false;
NotifyParams.bInClientSimulationPlayerOnly = false;
NotifyParams.bInServerSimulationPlayerOnly = false;
NotifyParams.bInSimulatedProxyPlayerOnly = false;
NotifyParams.bInOwnerOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyPlayerOnly = false;
NotifyParams.bInServerOnlyPlayerOnly = false;
NotifyParams.bInClientOnlyPlayerOnly = false;
NotifyParams.bInSimulatedOnlyPlayerOnly = false;
NotifyParams.bInReplicatedOnlyPlayerOnly = true;
NotifyParams.bInOwnerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInAutonomousProxyReplicatedOnlyPlayerOnly = false;
NotifyParams.bInServerReplicatedOnlyPlayerOnly = false;
NotifyParams.bInClientReplicatedOnlyPlayerOnly = false;
NotifyParams.bInSimulatedProxyReplicatedOnlyPlayerOnly = false;希望以上解答对您有所帮助。如果您有任何疑问,欢迎在评论区提出。
解决 无用评论 打赏 举报- 关键点分析: