Add support for spawning network object on custom set of clients

This commit is contained in:
Wojciech Figat
2022-11-02 12:13:44 +01:00
parent 043beb03a9
commit 70cfbada04
2 changed files with 113 additions and 22 deletions

View File

@@ -6,6 +6,9 @@
#include "Engine/Scripting/ScriptingObject.h"
#include "Engine/Scripting/ScriptingType.h"
template<typename T>
class DataContainer;
/// <summary>
/// The high-level network object role and authority. Used to define who owns the object and when it can be simulated or just replicated.
/// </summary>
@@ -73,6 +76,14 @@ public:
/// <param name="obj">The object to spawn on other clients.</param>
API_FUNCTION() static void SpawnObject(ScriptingObject* obj);
/// <summary>
/// Spawns the object to the other clients. Can be spawned by the owner who locally created it (eg. from prefab).
/// </summary>
/// <remarks>Does nothing if network is offline.</remarks>
/// <param name="obj">The object to spawn on other clients.</param>
/// <param name="clientIds">List with network client IDs that should receive network spawn event. Empty to spawn on all clients.</param>
API_FUNCTION() static void SpawnObject(ScriptingObject* obj, const DataContainer<uint32>& clientIds);
/// <summary>
/// Despawns the object from the other clients. Deletes object from remove clients.
/// </summary>