10
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UnityWebRequestでもローカルファイルの取得ができる

Posted at

Unityにおいて、従来のバージョンで使われていたWWWクラスと同様にUnityWebRequestでもローカルファイルの取得ができます。

例えばこんな感じ (C#, Unity5.4.4f1にて検証)

IEnumerator GetLocalFile(string filename){
    UnityWebRequest request = UnityWebRequest.Get ("file://" + Application.persistentDataPath + filename);
    yield return request.Send();
    if (!request.isError){
        //正常系処理
    }else{
        //エラー処理
    }
}

当たり前すぎるからかもしれませんが日本語で明確な記述が見当たらなかったので備忘録

10
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?