-
Notifications
You must be signed in to change notification settings - Fork 457
Description
Description
While working on #2507, I remarked that calling serverObject.ChangeOwnership(NetworkManager.ServerClientId)
doesn't have the same effect as serverObject.RemoveOwnership()
. Moreover, some automated tests use the first one, others the second.
The difference is subtil, but server side, when removing the ownership, the object entry is deleted in NetworkSpawnManager.OwnershipToObjectsTable
, while giving ownership back to the server keeps it.
Since the ownership is given back to the server in both case, I think we should let the entry in the table. The entry should be deleted only on despawn.
com.unity.netcode.gameobjects/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs
Line 197 in a418eab
internal void RemoveOwnership(NetworkObject networkObject) |
com.unity.netcode.gameobjects/com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs
Line 259 in a418eab
internal void ChangeOwnership(NetworkObject networkObject, ulong clientId) |
Shouldn't RemoveOwnership()
just calls ChangeOwnership(NetworkManager.ServerClientId)
instead of having a "copy/paste but not identical" implementation?
If there is a difference made on purpose between those two calls, documentation needs to be updated to explain it.
Environment
- OS: Windows 11
- Unity Version: 2020.3.40f1 (the automated testing project of this repo)
- Netcode Version: develop
- Netcode Commit: 449bf94