Skip to content

Commit 0e8d1c9

Browse files
author
mischa
committed
fix: #3528 NPC 'isOwned' / 'hasAuthority' now evaluate to true on the server/host
1 parent 020c514 commit 0e8d1c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Assets/Mirror/Core/NetworkServer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,11 @@ static void SpawnObject(GameObject obj, NetworkConnection ownerConnection)
13991399
if (ownerConnection is LocalConnectionToClient)
14001400
identity.isOwned = true;
14011401

1402+
// NPCs (objects without an owner connection) are owned by the server.
1403+
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3528
1404+
if (ownerConnection == null)
1405+
identity.isOwned = true;
1406+
14021407
// only call OnStartServer if not spawned yet.
14031408
// check used to be in NetworkIdentity. may not be necessary anymore.
14041409
if (!identity.isServer && identity.netId == 0)

0 commit comments

Comments
 (0)