Unity导出AssetBundle到指定路径
using System.Collections;
using UnityEngine;
using UnityEditor;
using System.IO; /// <summary>
/// 把工程中设置了AssetBundle Name的资源打包成.unity3d 到StreamingAssets目录下
/// </summary>
public class ExportAssetBundle : EditorWindow
{
// public static string sourcePath = Application.dataPath + "/Resources";
private string OutputPath = "Assets/StreamingAssets"; [MenuItem("AssetsManager/导出所有AssetBundle")]
static void AddWindow()
{
//创建窗口
ExportAssetBundle window = (ExportAssetBundle)EditorWindow.GetWindowWithRect(typeof(ExportAssetBundle),new Rect(Screen.width/,Screen.height/,,), true, "导出AssetBundle");
window.Show(); } void OnGUI()
{
EditorGUILayout.BeginHorizontal();
GUILayout.Label("导出路径:");
OutputPath = EditorGUILayout.TextField(OutputPath);
if (GUILayout.Button("浏览"))
{
//EditorApplication.delayCall += OpenFolder;
OutputPath = EditorUtility.OpenFolderPanel("选择要导出的路径", "", "");
}
EditorGUILayout.EndHorizontal();
if (GUILayout.Button("打包",GUILayout.MinHeight()))
{
BuildAssetBundle();
this.Close();
}
} public void BuildAssetBundle()
{
string outputPath = Path.Combine(OutputPath, Platform.GetPlatformFolder(EditorUserBuildSettings.activeBuildTarget));
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
} //根据BuildSetting里面所激活的平台进行打包
BuildPipeline.BuildAssetBundles(outputPath, , EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); Debug.Log("打包完成"); }
} public class Platform
{
public static string GetPlatformFolder(BuildTarget target)
{
switch (target)
{
case BuildTarget.Android:
return "Android";
case BuildTarget.iOS:
return "IOS";
case BuildTarget.WebGL:
return "WebGL";
case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64:
return "Windows";
case BuildTarget.StandaloneOSXIntel:
case BuildTarget.StandaloneOSXIntel64:
case BuildTarget.StandaloneOSXUniversal:
return "OSX";
default:
return null;
}
}
}
Unity导出AssetBundle到指定路径的更多相关文章
- 将指定路径下的所有SVG文件导出成PNG等格式的图片(缩略图或原图大小)
原文:将指定路径下的所有SVG文件导出成PNG等格式的图片(缩略图或原图大小) WPF的XAML文档(Main.xaml): <Window x:Class="SVG2Image.Ma ...
- 整理的Unity导出安卓工程利用ANT进行多渠道批量打包APK
Unity导出的安卓工程利用ant进行多渠道循环批量打包 一:设置JAVA环境变量 做android开发的配置这个是基础. win7 下配置java环境变量,下面是链接 http://www.cnbl ...
- Unity导出xcode后自动化导入第三方SDK
最近因为在给项目接入第三方SDK,遇到了一个比较烦人的事情就是,每次出包都要重新根据第三方SDK说明设置xcode,每次最少花20分钟来设置,如果出错的话就不一定是20分钟的事了,所以我决定要做一个自 ...
- 实力封装:Unity打包AssetBundle(大结局)
→→前情提要:让用户选择要打包的文件←← 大结局:更多选择 Unity打包AssetBundle从入门到放弃系列终于要迎来大结局了[小哥哥表示实在写不动了o(╥﹏╥)o]... 经过上一次的教程,其实 ...
- 微信小程序导出当前画布指定区域的内容并生成图片保存到本地相册(canvas)
最近在学小程序,在把当前画布指定区域的内容导出并生成图片保存到本地这个知识点上踩坑了. 这里用到的方法是: wx.canvasToTempFilePath(),该方法作用是把当前画布指定区域的内容导出 ...
- Unity中几个特殊路径在各个平台的访问方式
1.文件路径Resources:Unity在发布成移动端项目后,其他文件路径都将不存在,但是如果有一些必要的资源,可以放在Resources文件夹下,因为这个文件夹下的所有资源是由Unity内部进行调 ...
- iOS将Unity导出的Xcode工程导入到另一个Xcode项目, 及常见报错的解决方法
demo下载地址 http://pan.baidu.com/s/1pLcpKpl 1.Unity导出工程时设置bundle id要与项目一致 2.修改bit code为NO 3.删除Main.stor ...
- 指定路径批量将xls转换成csv
PS : 用到spire库,.net控制台应用程序 其实本来没打算写这个工具的,只是最近需要用到,手头上正好没有这样的工具,那么怎么办,写呗! 其实说白了就是省事,策划想怎么玩,把表把工具丢给他,省得 ...
- Unity导出Gradle工程给Android Studio使用
1 Unity导出Gradle项目 Unity打包时Build System选择Gradle,勾选Export Project 2 Android Studio导入Unity导出的Gradle项目 打 ...
随机推荐
- sqlserver 巧用REVERSE和SUBSTRING实现lastindexof
原文:sqlserver 巧用REVERSE和SUBSTRING实现lastindexof select REVERSE(SUBSTRING(REVERSE(testFixtureNumber),0, ...
- hdu1008(c++)
分清上升停留下降一步步来就是了 #include<iostream>#include<vector>using namespace std;int main(){ int N, ...
- windows上的docker容器内安装vim
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable t ...
- go语言编程小tips
go语言一个比较方便的特性是你不需要显示的定义一个变量.例如,在c语言中,你想要使用一个int型变量,那么代码如下 int i; i =0; i++; 而在go语言中, i := 0; i++ 这样你 ...
- QT静态库和动态库的导出
因为静态库是不须要导出的.所以在写QT的前置声明的时候须要说明 #if defined(QT_SHARED) #ifdef COMMONLIB #define COMMONLIB_EXPORT Q_D ...
- Material Design (二),TextInputLayout的使用
前言 一般登录注冊界面都须要EditText这个控件来让用户输入信息,同一时候我们通常会设置一个标签(使用TextView)和EditText的hint属性来提示用户输入的内容,而设计库中高级组件T ...
- running android lint has encountered a
近期写学习android编程的的时候,每次保存.java文件的时候,总会跳出例如以下错误 这个错误不是属于程序错误,把它关掉对于编程没有不论什么影响,但每次见到这个就是不爽,希望大神可以解决一下,谢谢 ...
- Windows / Linux 一件编译zlib库
一. 下载zlib库 : http://www.zlib.net 本文以 zlib-.tar.xz 为例 二. 解压文件得到 zlib- 文件夹,修改 zlib-/CMakeLists.txt 文 ...
- Centos6.6 以rpm方式安装mysql5.6
一.查看系统中有没有mysql的源 yum repolist all | grep mysql 二.配置源 1.配置源参考mysql官方给出的源配置,https://dev.mysql.com/doc ...
- bzoj2115【WC2001】Xor
2115: [Wc2011] Xor Time Limit: 10 Sec Memory Limit: 259 MB Submit: 2059 Solved: 856 [Submit][Statu ...