[Snippet] C# NetworkCallbackDelegate

Edit
Explained in the post below.

then post your workaround here kthx

Client.cs

BaseScript.TriggerServerEvent("eventName", new Action<object>((arg) =>
            {
                // Code here is executed after the server
                // arg is the data the Server returns
                // In this example we are expecting an object variable from the Server
            }));

Server.cs

RegisterEventHandler("eventName", new Action<NetworkCallbackDelegate>(OnEvent));

private void OnEvent(NetworkCallbackDelegate networkCB)
        {
            // Code here is executed when the event triggers
            // Invoking the delegate NetworkCallback executes Client's code
            // You have to pass an object variable because we have specified it in the Client
            networkCB.Invoke(5);
            // In this example we are telling the Client that the Server has returned 5.
        }

Hope this is useful to you.

8 Likes

Oh thanks !
1 year after my initial post :smiley: :smiley:

1 Like

Wow, I didnt know this was a thing. Thank you.