Add NetworkReplicationNode::SetObject to customize object replication settings at runtime
This commit is contained in:
@@ -74,6 +74,17 @@ bool NetworkReplicationNode::GetObject(ScriptingObject* obj, NetworkReplicationH
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NetworkReplicationNode::SetObject(const NetworkReplicationHierarchyObject& value)
|
||||||
|
{
|
||||||
|
const int32 index = Objects.Find(value.Object);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
Objects[index] = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool NetworkReplicationNode::DirtyObject(ScriptingObject* obj)
|
bool NetworkReplicationNode::DirtyObject(ScriptingObject* obj)
|
||||||
{
|
{
|
||||||
const int32 index = Objects.Find(obj);
|
const int32 index = Objects.Find(obj);
|
||||||
|
|||||||
@@ -208,6 +208,13 @@ API_CLASS(Abstract, Namespace = "FlaxEngine.Networking") class FLAXENGINE_API Ne
|
|||||||
/// <returns>True on successful retrieval, otherwise false.</returns>
|
/// <returns>True on successful retrieval, otherwise false.</returns>
|
||||||
API_FUNCTION() virtual bool GetObject(ScriptingObject* obj, NetworkReplicationHierarchyObject& result);
|
API_FUNCTION() virtual bool GetObject(ScriptingObject* obj, NetworkReplicationHierarchyObject& result);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets object properties in the hierarchy. Can be used to modify replication settings at runtime.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The object data to update.</param>
|
||||||
|
/// <returns>True on successful update, otherwise false (eg, if specific object has not been added to this node).</returns>
|
||||||
|
API_FUNCTION() virtual bool SetObject(const NetworkReplicationHierarchyObject& value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Force replicates the object during the next update. Resets any internal tracking state to force the synchronization.
|
/// Force replicates the object during the next update. Resets any internal tracking state to force the synchronization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user