i have error on this script, how can i fix it.
NullReferenceException: Object reference not set to an instance of an object
LoadImage.Update () (at Assets/LoadImage.cs:25) is this line: if (!imgLink.isDone)
usingUnityEngine;
usingUnityEngine.UI;
usingSystem.Collections;
[ExecuteInEditMode]
publicclassLoadImage: MonoBehaviour
{
stringurl = "http://nfx.000webhostapp.com/gazin.jpg";
Texture2Dimg;
publicSpriteRendererspriteRenderer;
publicImageFilling;
publicGameObjectLoading;
WWWimgLink;
//Usethisforinitialization
voidStart()
{
spriteRenderer.sprite = null;
StartCoroutine(LoadImg());
}
voidUpdate ()
{
if (!imgLink.isDone)
Filling.fillAmount = imgLink.progress;
}
IEnumeratorLoadImg()
{
yieldreturn0;
//spriteRenderer.sprite = null;
imgLink = newWWW(url);
yieldreturnimgLink;
img = imgLink.texture;
Spritesprite = Sprite.Create(img, newRect(0, 0, img.width, img.height), newVector2(0.5f, 0.5f));
spriteRenderer.sprite = sprite;
Loading.SetActive (false);
}
voidOnGUI()
{
}
}