Created
December 31, 2015 22:57
-
-
Save emoacht/89590d4e4571d40f9e1b to your computer and use it in GitHub Desktop.
Sample usage of UnityWebRequest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using UnityEngine; | |
using UnityEngine.Experimental.Networking; | |
public class UnityWebRequestUsage : MonoBehaviour | |
{ | |
void Start() | |
{ | |
StartCoroutine(GetText()); | |
} | |
IEnumerator GetText() | |
{ | |
using (UnityWebRequest request = UnityWebRequest.Get("http://unity3d.com/")) | |
{ | |
yield return request.Send(); | |
if (request.isError) // Error | |
{ | |
Debug.Log(request.error); | |
} | |
else // Success | |
{ | |
Debug.Log(request.downloadHandler.text); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any sample usage about HTTPS / certificates ? (using auto-signed certificates ?)