- Home /
UnityWebRequest timeout not containing
I am trying to use Mapbox but I am receiving this error in the code provided in the SDK.
namespace Mapbox.Unity.Utilities
{
using System;
using UnityEngine.Networking;
using System.Collections;
using Mapbox.Platform;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
internal sealed class HTTPRequest : IAsyncRequest
{
private UnityWebRequest _request;
private readonly Action<Response> _callback;
private UnityWebRequest timeout;
public bool IsCompleted { get; private set; }
public HTTPRequest(string url, Action<Response> callback, int timeout)
{
//UnityEngine.Debug.Log("HTTPRequest: " + url);
IsCompleted = false;
_request = UnityWebRequest.Get(url);
_request.timeout = timeout;
_callback = callback;
Assets/Mapbox/Unity/Utilities/HTTPRequest.cs(33,13): error CS1061: Type UnityEngine.Networking.UnityWebRequest' does not contain a definition for
timeout' and no extension method timeout' of type
UnityEngine.Networking.UnityWebRequest' could be found. Are you missing an assembly reference?
Can anyone help me solve this?
Answer by WilfridLefebvre · Jan 31, 2018 at 06:09 PM
Hi @nyush-rits, I just noticed the same trouble when trying to use my code on my Mac running Unity v5.5.2f1. The UnityEngine.Networking.UnityWebRequest.timeout is well recognized on my PC running Unity v5.5.4f1 I'll try to update my Mac and let you know...
Bingo !!! Timeout property was added on 5.5.4 !!! => https://unity3d.com/fr/unity/whats-new/unity-5.5.4 :
I$$anonymous$$PROVE$$anonymous$$ENTS :
Added support for the 5th generation iPad.
AssetBundles: Reduced SerializedFile memory usage when reading streams inside AssetBundles
Build Pipeline: Exceptions thrown during the build process (e.g. by user callbacks) are now treated the same as logged errors, from a reporting and Strict$$anonymous$$ode point of view.
Graphics: Added function to allow cube map textures to be compressed from script like their Texture2D counterparts
Networking: Added a timeout property to UnityWebRequest. This gives coarse grain control over timeouts for webrequests. (900900)
Hey! Thanks for your reply, I am already running 5.6.0f3 I have managed to bypass the problem by commenting out timeout but I don't think that is the best solution right now
Your answer
Follow this Question
Related Questions
Any way to speed up WWW requests? 2 Answers
Where to continue in Response/request? 0 Answers
HTTP Requests removed on Android Pie (API 28+) 2 Answers
Unity networking tutorial? 6 Answers
Is HttpWebRequest supported for desktop and editor? 2 Answers