0
我需要让玩家在车上消失。现在,它可以作为单人游戏使用,但由于我是“Unet”的新手,我不知道如何实现这一点,所以我尝试了一些方法,但他们没有奏效。下面是脚本:Unity网络,让玩家消失所有客户
[Client]
void OnControllerColliderHit(ControllerColliderHit hit)
{
//so if we hit car
if(hit.collider.tag == "Vehicle")
{
//if we pressed "E"
if (Input.GetKeyDown(KeyCode.E))
{
//call method to disable some stuff taht should be disabled, like: controller, shoot, weapons etc.
if (isServer)
CmdCall(inVehicle, hit);
else
RpcCall(inVehicle, hit);
}
}
}
[Command]
void CmdCall(bool invehicle, ControllerColliderHit hit){
RpcCall(inVehicle, hit);
}
[ClientRpc]
void RpcCall(bool invehicle, ControllerColliderHit hit)
{
disable(inVehicle, hit);
}
我无法看到控制台的任何错误,但我不能进入播放模式的原因有一些编译器错误,再次我不能在控制台中看到。感谢您的任何提示,评论,downvote,给予好评,或提示:)