Unity - A计划(一年有效期) 扫二维码继续学习 二维码时效为半小时

(61评价)
价格: 2155.00元
关于UNet Command远程调用的一个问题
wangchaoqun1997发起了问答2018-08-10
2
回复
888
浏览

附件UNetQuestion.zip中有这个简单的工程

因为官网有描述command :

Commands are sent from player objects on the client to player objects on the server. For security, Commands can only be sent from YOUR player object, so you cannot control the objects of other players.

所以只有local gameobject调用command后才会在server端的此gameobject (同netId)上调用,所以在Server端起来后,创建了Server端的local client的player gameobject,此时server端log输出:

True

1

这是是符合官网的说法的,奇怪的是下一步,当创建一个Remote Client时,发现Server端居然输出了如下log

False

2

按正常思路,Remote Client创建时,Server端首先创建Remote Client的player gameobject,然后spawn到Remote Client,由于Server创建的这个Remote Client在Server端而言不是Local player,所以调用command是不成功的,结果Server端打出如上log表明command调用成功了,请问siki的老师们这是什么情况?

QQ 719502447

谢谢

所有回复
发表回复
你还没有登录,请先 登录或 注册!