Question by
appleorbit · Mar 02, 2018 at 03:37 PM ·
networkperformancespikes
Spikes because of the very poor performance of UnityWebRequest.Get() on Android.
UnityWebRequest.Get () on Andoid caused a spike of 20 ms or more.
I want to solve this problem in order to load data with Background.
Please tell me the solution to this problem.
Unity version is 2017.3.1f1.
If there are some mistakes in English, I’d like to apologize.
public void DoRequest(string url, Action<string> onComplete)
{
UnityEngine.Profiling.Profiler.BeginSample ("Request.Get");
var request = UnityWebRequest.Get (url); // very poor perfomance.
UnityEngine.Profiling.Profiler.EndSample ();
StartCoroutine (Exec(request, onComplete));
}
private IEnumerator Exec(UnityWebRequest request, Action<string> onComplete)
{
yield return request.SendWebRequest ();
onComplete.SafeInvoke (request.downloadHandler.text);
request.Dispose ();
request = null;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612153813im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Memory Issues while App Launching,Memory Spike right before Splash Screen(Cold Start?) 0 Answers
Regular stutters in performance after a minute or two 0 Answers
UI shows performance drop on iOS but not on Android 1 Answer
Need help profiling first game. Huge GPU spikes? 1 Answer
Checking Internet inside a Coroutine 0 Answers