如何在Unity 3D 2018中下载资产捆绑并在本地使用?

时间:2019-01-05 18:26:44

标签: c# unity3d assetbundle

我想通过先检查版本来下载资产捆绑包,如果有新版本,游戏会自动下载它并在此之后在本地使用它? 到目前为止,我所做的只是下载资产捆绑包,这是我的代码:

using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

public class loader : MonoBehaviour
{
private AssetBundleCreateRequest bundleRequest;
private UnityWebRequest request;

private void Start()
{

          request = UnityWebRequestAssetBundle.GetAssetBundle("http://localhost/focus/level2",1);
    request.SendWebRequest();
}

private void Update()
{
    if (request.isDone)
    {
        AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);

        SceneManager.LoadScene("SampleScene");
    }
    else
    {
        Debug.Log("not");
    }
}

}

0 个答案:

没有答案