3
1

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 1 year has passed since last update.

Unity2021でUnityWebRequestでエラーが出る

Posted at

Unity2021.2.10f1にアップデートしたところ、
UnityWebRequestでエラーが出力されるようになった。
(Unity2020ではエラー出ていなかった)

A Native Collection has not been disposed, resulting in a memory leak. Allocated from:
Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator) (at /Users/bokken/buildslave/unity/build/Runtime/Export/NativeArray/NativeArray.cs:69)
UnityEngine.Networking.UploadHandlerRaw:.ctor(Byte[]) (at /Users/bokken/buildslave/unity/build/Modules/UnityWebRequest/Public/UploadHandler/UploadHandler.bindings.cs:95)

どうやら使い終わった時に明示的に Dispose() を呼ばないといけないようだった。

UnityWebRequest request = new UnityWebRequest(url);

... 通信処理

// 通信終了後明示的にDisposeを呼び出す
request.Dispose();
3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?