RaiseEventAll
Method
Raise a remote event to all actors connected to the current server.
Note that this will also raise the event on the current actor, which triggers the onEvent
callback.
Definition
void RaiseEventAll(byte eventID, params object[] args)
void RaiseEventAll(byte eventID, params object[] args)
Examples
const byte EVENT_ID = 8;// A byte unique to this event
void OnEnable()
{
// Register listener for incoming network events
SpatialBridge.networkingService.remoteEvents.onEvent += HandleEvent;
}
void OnDisable()
{
SpatialBridge.networkingService.remoteEvents.onEvent -= HandleEvent;
}
void HandleEvent(NetworkingRemoteEventArgs args)
{
// Parse all incoming network events. Check for the correct ID
if (args.eventID == EVENT_ID)
{
// Display the message
SpatialBridge.coreGUIService.DisplayToastMessage((string)args.eventArgs[0]);
}
}
public void SendEventToAllPlayers()
{
// Send a network event to all players
SpatialBridge.networkingService.remoteEvents.RaiseEventAll(EVENT_ID, "Greetings!");
}
const byte EVENT_ID = 8;// A byte unique to this event
void OnEnable()
{
// Register listener for incoming network events
SpatialBridge.networkingService.remoteEvents.onEvent += HandleEvent;
}
void OnDisable()
{
SpatialBridge.networkingService.remoteEvents.onEvent -= HandleEvent;
}
void HandleEvent(NetworkingRemoteEventArgs args)
{
// Parse all incoming network events. Check for the correct ID
if (args.eventID == EVENT_ID)
{
// Display the message
SpatialBridge.coreGUIService.DisplayToastMessage((string)args.eventArgs[0]);
}
}
public void SendEventToAllPlayers()
{
// Send a network event to all players
SpatialBridge.networkingService.remoteEvents.RaiseEventAll(EVENT_ID, "Greetings!");
}