简体   繁体   English

无权限镜像的 object 命令

[英]command for object without authority mirror

I having problems with unity mirror.我在使用统一镜像时遇到问题。 When respawn IEnumerator is called, the player respawn but it disconnect from the server, he cant move (only locally) and he cant do commands.当调用 respawn IEnumerator 时,玩家重生但它与服务器断开连接,他无法移动(仅在本地)并且他无法执行命令。 this is the respawn code:这是重生代码:

    [Server]
IEnumerator Respawn(GameObject go){
    print("Player ded");
    NetworkServer.UnSpawn(go);
    Transform newPos = NetworkManager.singleton.GetStartPosition();
    go.transform.position = newPos.position;
    go.transform.rotation = newPos.rotation;
    yield return new WaitForSeconds(1f);
    NetworkServer.Spawn(go);
}

Any solutions to that problem please?请问这个问题有什么解决办法吗?

I would need the whole script to make sure I am right, but I am pretty sure, that the problem is that you call [Server] via a client (which isn't allowed).我需要整个脚本来确保我是正确的,但我很确定,问题在于您通过客户端调用 [Server](这是不允许的)。

[Server] is used to make sure that only the server can call the function. [Server]用于确保只有服务器可以调用function。 Not a client, that would explain why the player is disconnected, when the function is called.不是客户端,这可以解释为什么在调用 function 时播放器会断开连接。

It would probably work if you change [Server] to [Command(requiresAuthority = false)].如果您将 [Server] 更改为 [Command(requiresAuthority = false)],它可能会起作用。 Link to the [Command] documentation: Mirror documentation If not please send the whole script.链接到 [Command] 文档: 镜像文档如果没有,请发送整个脚本。

With regards,带着敬意,

Aaron亚伦

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Unity Multiplayer (Mirror) - 在所有客户端同步游戏对象的变量时出现问题。 [试图在没有权限的情况下发送 object 的命令] - Unity Multiplayer (Mirror) - Problem in syncing game object's variables across all clients. [Trying to send command for object without authority] Unity3D。 试图在没有权限的情况下为对象发送命令 - Unity3D. Trying to send command for object without authority Unity:当连接多个客户端时,尝试为对象发送命令而没有权限错误 - Unity : Trying to send command for object without authority error when more than one client is connected 为什么宿主玩家没有权限向服务器发送【命令】? 统一 - 镜子 - Why does the host player not have authority to send server [Command]? Unity - Mirror unity / Mirror 第二个玩家对 PlayerController 没有权限 - Unity / Mirror second player has no authority on PlayerController 转移客户端权限后的 Unity/Mirror 网络延迟 - Unity/Mirror Network Delay After Transferring Client Authority c# + autocad 镜像命令 - c# + autocad mirror command Unity Mirror,客户端未执行损坏命令 - Unity Mirror, Client is not executing damage Command 使用不带对象的WebDriver / Seleneium输入击键以将命令发送到 - Entering Keystrokes with WebDriver/Seleneium without an Object to send the command to 客户端无法在服务器上生成 object - Unity 镜像网络 c# - Clients cannot spawn object on server - Unity mirror networking c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM