Download Texture from Url

Learn how to download a texture form url

If you want to download the texture from the url, you can make use of DownloadTexture class provided in VoxelBusters.SnapchatKit.Common.Utility namespace

using VoxelBusters.SnapchatKit.Common.Utility;

private void DownloadTextureFromUrlPath(string urlPath)
{
    DownloadTexture _newDownload = new DownloadTexture(new URL(urlPath), true, true);
    _newDownload.OnCompletion = (Texture2D _texture, string _error)=>{
        Debug.Log(string.Format("[DownloadAvatar] Texture download completed. Error= {0}.", _error.GetPrintableString()));
        //Access downloaded texture from _texture here. 
        };
        
    // Start the request 
    _newDownload.StartRequest();
}

Last updated