Horje
unity chat system Code Example
unity chat system
void TaskOnClick()
    {
        // When the user clicks the Submit button,
        // create a JSON object from input field input
        JSONInformation publishMessage = new JSONInformation();
        publishMessage.username = string.Concat(UsernameInput.text, ": ");
        publishMessage.text = TextInput.text;
        string publishMessageToJSON = JsonUtility.ToJson(publishMessage);

        // Publish the JSON object to the assigned PubNub Channel
        pubnub.Publish()
            .Channel("chatchannel")
            .Message(publishMessageToJSON)
            .Async((result, status) =>
            {
                if (status.Error)
                {
                    Debug.Log(status.Error);
                    Debug.Log(status.ErrorData.Info);
                }
                else
                {
                    Debug.Log(string.Format(result.Timetoken));
                }
            });

        // Reset the text field to be blank
        TextInput.text = "";
    }
Source: unity.chat




Csharp

Related
unity c# struct Code Example unity c# struct Code Example
.net: setting max size for sql parameter Code Example .net: setting max size for sql parameter Code Example
jitter on collision for 2 rigid bodies Code Example jitter on collision for 2 rigid bodies Code Example
how to draw over label C# Code Example how to draw over label C# Code Example
unity temperature to colour Code Example unity temperature to colour Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10