Learn How To Download Asset Bundle From Server in Unity 3D | Under 2 Minutes

0
522

Hello Everyone !!

I have been receiving a lot of requests to make a tutorial on how to download asset bundle from server in Unity 3D. Here I made a simple video tutorial for you guys to learn how you can download asset bundle from server under 2 minutes.

Asset bundles are a great way to maintain and expand your game. In this video I show you how to set up asset bundles and use them in an online Unity game or application. I have also written about making and exporting asset bundles here.

Downloading asset bundle from server is as easy as shown. In under 2 minutes you will see how I downloaded asset bundles from server using simple Unity 3D and C# code.

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
 
public class MyBehaviour : MonoBehaviour {
    void Start() {
        StartCoroutine(GetAssetBundle());
    }
 
    IEnumerator GetAssetBundle() {
        UnityWebRequest www = UnityWebRequest.GetAssetBundle("http://www.my-server.com/myData.unity3d");
        yield return www.SendWebRequest();
 
        if(www.isNetworkError || www.isHttpError) {
            Debug.Log(www.error);
        }
        else {
            AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
        }
    }
}

 

Watch my All unity tutorials.

Learn about unity video player.