Remote Event
For sending events of GameObjects
Last updated
For sending events of GameObjects
Last updated
Remote Events are created in the Unity Editor Inspector by selecting the Add Remote Event button.
You can have up to 250 remote events in one Remote Event Agent.
Maximum message size of a remote event is 4KB.
Name | Function |
Event Name | Unique name of the Event. The Event name is used to find and trigger event across different network. Event name must be unique in the same Remote Event Agent Component. |
Target | Controls the recipients of the remote event. All: All the players in the room. Exclude self: All the players in the room except the sender. Host only: Room host only. |
Remote Events are invoked by calling SWNetwork API in C# scripts.
Invoke a Remote event
Invoke a Remote event with the specified message
The eventName string parameter pass to the Invoke method has to match with Event Name value in the Remote Event Agent Inspector.
This example uses SWNetworkMessage to send the bullet launch position(vector3) and aim direction (vector3) along with the remote event.
Handling remote event is done by adding listener to the remote event.
In this example, we used the PopVector3() method on the SWNetworkMessage objet to obtain the launch position and the aim direction of the fire remote event.