- Download project (or just
ImgDisp.cs) - Select a game object in your scene (that needs the image)
- Add the
ImgDispscript to it - Turn that game object into a prefab
- Add
using awillInc;to your C# script - Add a
public(or private with[SerializeField]) variable to your scriptpublic ImgDisp IMG_PREFAB;is what I use inMain.cs
- Instantiate an instance of the class using the prefab:
ImgDisp img = Instantiate(IMG_PREFAB, Vector3.zero, Quaternion.identity, imgContainer);- In the example,
imgContaineris used to hold images, but you can supply anyTransformas the parent for the image
- Explicitly load the image by URL:
ImgDisp.loadSpriteToObject(imageURLs[i], img);
- When you request an image, this component:
- Checks to see if image exists locally
- If it does, load it from disk and use it
- If it does not, download it from web (if possible), save it to disk (if possible), and use the downloaded resource