fjkrl 发表于 2013-3-7 10:31

Unity3D动态加载FBX文件

Unity3D动态加载FBX文件
方法1:1.将模型拖动到场景中 ,调整好位置。(制作prefab需要)。2.新建Resources(如果工程中有的话 就不用新建了,Resource.Load调用的就是该文件夹下的资源),在该文件夹下建一个prefab,将上面的模型拖动到这个prefab上。3.删除场景中的该物体模型。4.编写脚本,把它仍随便一个GameObject。代码如下:using UnityEngine;using System.Collections;public class LoadFBX : MonoBehaviour {// Use this for initializationvoid Start () {GameObject gFbx=(GameObject)Instantiate( Resources.Load("che"));}// Update is called once per framevoid Update () {}}方法2:1.按方法1 制作prefab 注意调整好位置。2.然后使用AssetBundle导出包选项 create single AssetBundle(这之前需要在工程文件夹中新建一个叫做“Dynamic_Asset”的文件夹)。3.这时可以看到导出的.AssetBundle文件了。4.编写代码如下:public string url;void Start () {string Scname = "scene1_part2.assetbundle";url = "file://F:/EZGUI/Dynamic_Asset/";StartCoroutine(DLAsset(url,Scname));}void Update () {}public IEnumerator DLAsset (string url,string Scname) {WWW www = new WWW(url+Scname);yield return www;GameObject GO = (GameObject)Instantiate;}

cclove 发表于 2013-3-8 09:25

这是个什么东东。

animan 发表于 2013-3-10 08:28

谢谢分享。。。。。。

calss008 发表于 2013-3-22 15:30

好不错 挺好的!~

babyface 发表于 2013-4-9 23:22


我很懒,只想回复看看,另感谢楼主分享{:soso__16915934313317769624_2:}

平常心 发表于 2013-6-22 11:58

真的不错。谢谢分享。

go369 发表于 2017-2-28 20:10

顶顶多好

xw12369 发表于 2017-2-28 20:48

真心顶

你微笑时好美丶 发表于 2017-2-28 20:39

难得一见的好帖

a461606466 发表于 2017-2-28 19:51

很好哦
页: [1] 2 3 4 5 6 7 8 9
查看完整版本: Unity3D动态加载FBX文件