hi, guys, I am doing a 2d app to save and download the image I want to save the image from web and load the images save and load fine but the problem is it says coroutine cannot use thanks for listening!
error:
Coroutine ‘https://img.etimg.com/thumb/msid-67102450,width-300,imgsize-65522,resizemode-4/sedan-car-getty.jpg’ couldn’t be started!
UnityEngine.MonoBehaviour:StartCoroutine(String)
c__Iterator2:MoveNext() (at Assets/scripts/save and load/load.cs:250)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
load:seq(String) (at Assets/scripts/save and load/load.cs:245)
load:image1() (at Assets/scripts/save and load/load.cs:78)
UnityEngine.EventSystems.EventSystem:Update()
here’s the code:
void seq(string url)
{
StartCoroutine(Seq(url));
}
private IEnumerator Seq(string url)
{
yield return StartCoroutine(url);
yield return StartCoroutine(waittoload());
}
private IEnumerator imageload(string url)
{
StartCoroutine(DownloadImage(url));
yield return DownloadImage(url);
Debug.Log(“loaded”);
}
private IEnumerator waittoload()
{
yield return new WaitForSeconds(0f);
}
and the function i declared(courotine):
public void image1()
{
if (downloadimage.Instance.save == true)
{
if (downloadimage.Instance.imagesloaded <= 2)
downloadimage.Instance.loadimage1();
if (downloadimage.Instance.imagesloaded <= 2)
if (is2)
{
raw.texture = downloadimage.Instance.texture;
}
else
{
seq(downloadimage.Instance.url[0]);
is2 = true;
Debug.Log("imageloaded!");
}
}
else
{
if (downloadimage.Instance.imagesloaded <= 2)
Debug.Log("time to load");
StartCoroutine(DownloadImage(downloadimage.Instance.url[0]));
downloadimage.Instance.imagesloaded++;
}