REST in Unity (send messages from webserver to unity)

后端 未结 3 1158
执笔经年
执笔经年 2021-01-28 05:29

Is there a way to have a simple webserver send messages to Unity?

At the moment, we\'re doing a GET using UnityWebRequest.Get() in the update

3条回答
  •  借酒劲吻你
    2021-01-28 06:01

    This is simple way to get request from RESTful server :D.

    private string m_URL = "https://jsonblob.com/api/d58d4507-15f7-11e7-a0ba-014f05ea0ed4";
    
    IEnumerator Start () {
        var webRequest = new WWW (m_URL);
        yield return webRequest;
        if (webRequest.error != null) {
            Debug.Log (webRequest.error);
        } else {
            Debug.Log (webRequest.text);
        }
    }
    

提交回复
热议问题