FBX生成Prefab
来源:互联网 发布:男鞋推荐学生知乎 编辑:程序博客网 时间:2024/05/17 22:44
using UnityEngine;using UnityEditor;using System.IO;using System.Collections;public class GeneratePrefab { private static string prefabDirectory = "/Prefab/Monster"; private static string prefabExtension = ".prefab"; [MenuItem("Example/Generate prefab")] public static void Generate() { GameObject selectedGameObject = Selection.activeGameObject; string selectedAssetPath = AssetDatabase.GetAssetPath(selectedGameObject); if(string.IsNullOrEmpty(selectedAssetPath)) { return; } string modelAssetPath = string.Concat(Application.dataPath,prefabDirectory); string modelParentPath = string.Concat("Assets/Resources", prefabDirectory); string modelFullPath = string.Concat(modelParentPath, "/", "model"); if (!Directory.Exists(modelFullPath)) { AssetDatabase.CreateFolder(modelParentPath , "model"); } GameObject cloneObj = GameObject.Instantiate<GameObject>(selectedGameObject); cloneObj.name = cloneObj.name.Replace("(Clone)", string.Empty); string genPrefabFullName = string.Concat(modelFullPath, "/", cloneObj.name, prefabExtension); Object prefabObj = PrefabUtility.CreateEmptyPrefab(genPrefabFullName); GameObject prefab = PrefabUtility.ReplacePrefab(cloneObj, prefabObj); GameObject.DestroyImmediate(cloneObj); }}
0 0
- FBX生成Prefab
- 自动分离FBX中SkinnedMeshRenderer并生成prefab
- u3d fbx动画模型生成Animator Controller和Prefab工具脚本
- 【Unity】FBX和Prefab 同名造成的问题
- cocosCreator prefab 自动生成代码
- Unity批量提取FBX中动作,并加好动作,生prefab
- Resources中读取prefab,动态生成控件
- Sprites,Editor使图片生成prefab
- Unity2D研究院之自动生成动画、AnimationController、Prefab(一)
- 根据序列帧生成Prefab,AnimationController,AnimationController和帧动画
- Unity生成的Prefab实例莫名产生position改变
- Prefab in Prefab
- unity3d导入fbx文件,与3dmax生成的fbx文件时,所遇到的单位问题
- Unity中使用UGUI制作Prefab后,调用Instantiate动态生成Button无法点击的解决方法
- Unity3D 动态创建的Mesh,导出为Obj模型文件,并生成Prefab文件
- Unity动态创建的Mesh,导出为Obj模型文件,并生成Prefab文件
- 从.fbx 到生成web版执行文件,完全不用unity集成开发环境
- FBX 资源
- vim配置文件
- Retrofit2.0使用详解
- oracle一步一步学习(一)
- Java反射机制
- 每天一个linux命令:gzip命令
- FBX生成Prefab
- 初探Lambda表达式-Java多核编程【0】从外部迭代到内部迭代
- MySQL(五)数据约束
- 利用opencv将两张图像在同一窗口上显示,并在图片上显示文字
- 栈与队列(五)链队列(链式结构)
- AngularJS学习笔记
- Plugin with id 'com.android.application' not found.
- 如何使用CSDN的MARKDOWN编辑器写博客
- Android的生命周期