Remote Event
For sending events of GameObjects
Create Remote Event
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.
Invoke Remote Event
Remote Events are invoked by calling SWNetwork API in C# scripts.
Invoke a Remote event
Invoke a Remote event with the specified message
Examples
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.
Handle Remote Event
Handling remote event is done by adding listener to the remote event.
Adding Listener using the Inspector
Adding Listener using C# code
Implement the handler function
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.
Last updated