Merge branch 'foreignobject' of https://github.com/Withaust/FlaxEngine into Withaust-foreignobject

This commit is contained in:
Wojtek Figat
2023-08-14 18:29:10 +02:00
2 changed files with 14 additions and 0 deletions

View File

@@ -941,6 +941,13 @@ bool NetworkReplicator::HasObject(const ScriptingObject* obj)
return false;
}
ScriptingObject* NetworkReplicator::ResolveForeignObject(Guid objectId)
{
if (const auto& object = ResolveObject(objectId))
return object->Object.Get();
return nullptr;
}
uint32 NetworkReplicator::GetObjectOwnerClientId(const ScriptingObject* obj)
{
uint32 id = NetworkManager::ServerClientId;

View File

@@ -116,6 +116,13 @@ public:
/// <param name="obj">The network object.</param>
/// <returns>True if object exists in networking, otherwise false.</returns>
API_FUNCTION() static bool HasObject(const ScriptingObject* obj);
/// <summary>
/// Resolves foreign Guid into a local ScriptingObject
/// </summary>
/// <param name="objectId">The Guid of a foreign object.</param>
/// <returns>Object if managed to resolve, otherwise null.</returns>
API_FUNCTION() static ScriptingObject* ResolveForeignObject(Guid objectId);
/// <summary>
/// Gets the Client Id of the network object owner.