User Tools

Site Tools


docs:api:loadspritefromurl

LoadSpriteFromUrl

public static IEnumerator LoadSpriteFromUrl(string url, System.Action<Sprite> onComplete)

Summary:

  • Loads an image from a remote URL and converts it into a Unity Sprite
  • This method is a coroutine and must be started with StartCoroutine
  • It performs basic validation on the url, converts common SVG path segments to PNG,
  • Downloads the texture via UnityWebRequest, and invokes onComplete with the created sprite (or null on failure).
IEnumerator LoadAvitarAsSprite()
{
    yield return LivelyWebGL.ExternalAssets.LoadSpriteFromUrl(avatarURL, (sprite) =>
    {
        if (sprite != null)
        {
            Debug.Log("Do something with sprite");
        }
    });
}
docs/api/loadspritefromurl.txt · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki