From 1e94e12150fb26fb506513f70037cab8fbf96571 Mon Sep 17 00:00:00 2001 From: mischa <16416509+miwarnec@users.noreply.github.com> Date: Sat, 21 Sep 2024 13:23:43 +0200 Subject: [PATCH] feature(NetworkTransform): ServerTeleport() function (#3899) Co-authored-by: mischa --- .../Components/NetworkTransform/NetworkTransformBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs b/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs index 876b9d3d0..85428ebf5 100644 --- a/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs +++ b/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs @@ -345,6 +345,14 @@ public void RpcTeleport(Vector3 destination, Quaternion rotation) OnTeleport(destination, rotation); } + // teleport on server, broadcast to clients. + [Server] + public void ServerTeleport(Vector3 destination, Quaternion rotation) + { + OnTeleport(destination, rotation); + RpcTeleport(destination, rotation); + } + [ClientRpc] void RpcResetState() {