Version: 5.4
public string error ;

説明

ダウンロード中にエラーが発生した場合のエラーメッセージ(読み取り専用)

もしエラーがない場合は errornull または空文字(空文字は一部のプラットフォームが string 値として null を許可していないため)を返します。ですので、エラーのチェックを行う場合は両方に対応するために String.IsNullOrEmpty を使用することをお勧めします。

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.

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); } }

この例では、エラーメッセージが「ホストが参照できない」となるので、この URL は有効ではありません。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961