Add network objects ownership changing with network sync

This commit is contained in:
Wojciech Figat
2022-10-24 15:02:11 +02:00
parent 494de7a9f4
commit 30fdde614d
4 changed files with 134 additions and 5 deletions

View File

@@ -87,6 +87,14 @@ public:
/// <returns>The object role.</returns>
API_FUNCTION() static NetworkObjectRole GetObjectRole(ScriptingObject* obj);
/// <summary>
/// Sets the network object ownership - owning client identifier and local role to use.
/// </summary>
/// <param name="obj">The network object.</param>
/// <param name="ownerClientId">The new owner. Set to NetworkManager::LocalClientId for local client to be owner (server might reject it).</param>
/// <param name="localRole">The local role to assign for the object.</param>
API_FUNCTION() static void SetObjectOwnership(ScriptingObject* obj, uint32 ownerClientId, NetworkObjectRole localRole = NetworkObjectRole::Replicated);
private:
#if !COMPILE_WITHOUT_CSHARP
API_FUNCTION(NoProxy) static void AddSerializer(const ScriptingTypeHandle& type, const Function<void(void*, void*)>& serialize, const Function<void(void*, void*)>& deserialize);