Add NetworkReplicationNode::GetObject

This commit is contained in:
Wiktor Kocielski
2023-06-25 23:39:59 +03:00
parent 9282bcfbbf
commit cbd1e5c837
2 changed files with 19 additions and 0 deletions

View File

@@ -63,6 +63,17 @@ bool NetworkReplicationNode::RemoveObject(ScriptingObject* obj)
return !Objects.Remove(obj);
}
bool NetworkReplicationNode::GetObject(ScriptingObject* obj, NetworkReplicationHierarchyObject& result)
{
const int32 index = Objects.Find(obj);
if (index != -1)
{
result = Objects[index];
return true;
}
return false;
}
bool NetworkReplicationNode::DirtyObject(ScriptingObject* obj)
{
const int32 index = Objects.Find(obj);

View File

@@ -200,6 +200,14 @@ API_CLASS(Abstract, Namespace = "FlaxEngine.Networking") class FLAXENGINE_API Ne
/// <returns>True on successful removal, otherwise false.</returns>
API_FUNCTION() virtual bool RemoveObject(ScriptingObject* obj);
/// <summary>
/// Gets object from the hierarchy.
/// </summary>
/// <param name="obj">The object to get.</param>
/// <param name="result">The hierarchy object to retrieve.</param>
/// <returns>True on successful retrieval, otherwise false.</returns>
API_FUNCTION() bool GetObject(ScriptingObject* obj, NetworkReplicationHierarchyObject& result);
/// <summary>
/// Force replicates the object during the next update. Resets any internal tracking state to force the synchronization.
/// </summary>