1 将模型拖动到场景中 ,调整好位置。(制作prefab需要)2 新建Resources(如果工程中有的话 就不用新建了,Resource.Load调用的就是该文件夹下的资源),在该文件夹下建一个prefab,将上面的模型拖动到这个prefab上3 删除场景中的该物体模型4 编写脚本,把它仍随便一个GameObject主要代码如下[csharp] view plaincopyusingunityEngine;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 编写代码如下[csharp] view plaincopypublic 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 G
unity将预制体写成fbx_unity 动态加载fbx的方法
最新推荐文章于 2024-06-13 23:41:20 发布