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

(66评价)
价格: 1299.00元
1对1 答疑即时回复7天无理由退款30天价保提问必答

服务保障

1对1 答疑

提供专属的一对一在线答疑,快速答疑解惑。

即时回复

及时响应学习咨询,帮助解决问题。

7天无理由退款

购买后7天内可申请无理由退款。

30天价保

购买后30天内如遇降价,可申请价保。

提问必答

对于提问做到有问必答,帮您扫清学习过程中的种种障碍

关于UNet Command远程调用的一个问题
wangchaoqun1997发起了问答2018-08-10
2
回复
1126
浏览

附件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

谢谢

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