码迷,mamicode.com
首页 > 编程语言 > 详细

unity学习 5.x解包

时间:2017-04-23 22:21:33      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:erer   generic   yield   typeof   5.x   gas   initial   component   assets   

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bundleloadasset : MonoBehaviour {

// Use this for initialization
void Start () {
StartCoroutine(Load());
}

// Update is called once per frame
void Update () {

}
IEnumerator Load()
{
WWW www = new WWW("file:///D:/MyUnity/assetdatabase3d/Assets/Bundle/2000.assetbundle");
//网上加载资源:WWW www = new WWW("file:///" + Application.streamingAssetsPath + "2000.assetbundle");
yield return www;
AssetBundle bundle = www.assetBundle;
AssetBundleRequest request= bundle.LoadAssetAsync("Assets/New Material.mat", typeof(Material));
yield return request;
GameObject.Find("/Cube").GetComponent<Renderer>().material = request.asset as Material;

}
}

unity学习 5.x解包

标签:erer   generic   yield   typeof   5.x   gas   initial   component   assets   

原文地址:http://www.cnblogs.com/gasolhome/p/6754113.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!