Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.
Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.
CerrarPor alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.
CerrarReturns an error message if there was an error during the download (Read Only).
If there was no error, error
will return null
or an empty string (this is because some platforms don't allow nulls for string values). We recommend that you use String.IsNullOrEmpty to check for the presence of an error so that both cases are covered.
If the object has not finished downloading the data, it will block until the download has finished.
Use isDone or yield
to see if the data is available.
// Make a request with an invalid url var url = "invalid_url"; function Start () { // Start a download of the given URL var www : WWW = new WWW (url);
// Wait for download to complete yield www;
// Print the error to the console if (!String.IsNullOrEmpty(www.error)) Debug.Log(www.error); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { // Make a request with an invalid url public string url = "invalid_url"; IEnumerator Start() { WWW www = new WWW(url); yield return www; if (!string.IsNullOrEmpty(www.error)) Debug.Log(www.error); } }
In the example the URL is not valid so the error message will be "Couldn't resolve host".