【Unity】像素图片导入批处理
2017-01-06 15:58
417 查看
具体可以参照 Unity3d 官方文档。
代码出处:http://blog.csdn.net/huutu
在此基础上添加了设置Filter Mode为Point模式,可以适用于像素图片的处理
当然同样可以处理,如下图所示的所有设置
/**************************
* 文件名:AutoSetTextureUISprite.cs;
* 文件描述:导入图片资源到Unity时,自动修改为UI 2D Sprite,自动设置打包tag 为文件夹名字;
* 创建日期:2015/05/04;
* Author:陈鹏;
***************************/
using UnityEngine;
using System.Collections;
using UnityEditor;
public class AutoSetTextureUISprite :AssetPostprocessor
{
void OnPreprocessTexture()
{
//自动设置类型;
TextureImporter textureImporter = (TextureImporter)assetImporter;
textureImporter.textureType=TextureImporterType.Sprite;
//自动设置打包tag;
string dirName = System.IO.Path.GetDirectoryName(assetPath);
Debug.Log("Import --- "+dirName);
string folderStr = System.IO.Path.GetFileName(dirName);
Debug.Log("Set Packing Tag --- "+folderStr);
textureImporter.spritePackingTag = folderStr;
//filtermode 自动设置为 point
textureImporter.filterMode = FilterMode.Point;//在这里添加就可以了
}
}
把这个.cs文件放入任意一个文件夹都是可以执行的
参考资料3的文章里面还描述了图片批处理,或者是UNITY添加快捷键的设置
文件分流:
Unity图片导入批处理
参考资料:
http://docs.unity3d.com/ScriptReference/AssetPostprocessor.OnPreprocessTexture.html
代码出处:http://blog.csdn.net/huutu
在此基础上添加了设置Filter Mode为Point模式,可以适用于像素图片的处理
当然同样可以处理,如下图所示的所有设置
/**************************
* 文件名:AutoSetTextureUISprite.cs;
* 文件描述:导入图片资源到Unity时,自动修改为UI 2D Sprite,自动设置打包tag 为文件夹名字;
* 创建日期:2015/05/04;
* Author:陈鹏;
***************************/
using UnityEngine;
using System.Collections;
using UnityEditor;
public class AutoSetTextureUISprite :AssetPostprocessor
{
void OnPreprocessTexture()
{
//自动设置类型;
TextureImporter textureImporter = (TextureImporter)assetImporter;
textureImporter.textureType=TextureImporterType.Sprite;
//自动设置打包tag;
string dirName = System.IO.Path.GetDirectoryName(assetPath);
Debug.Log("Import --- "+dirName);
string folderStr = System.IO.Path.GetFileName(dirName);
Debug.Log("Set Packing Tag --- "+folderStr);
textureImporter.spritePackingTag = folderStr;
//filtermode 自动设置为 point
textureImporter.filterMode = FilterMode.Point;//在这里添加就可以了
}
}
把这个.cs文件放入任意一个文件夹都是可以执行的
参考资料3的文章里面还描述了图片批处理,或者是UNITY添加快捷键的设置
文件分流:
Unity图片导入批处理
参考资料:1.Unity3d 导入图片 自动修改Texture Type为Sprite (2D and UI) 及设置 Packing Tag为文件夹名
2.Unity3d
导入图片 自动修改Texture Type
3.unity使用代码修改Texture属性,一键生成精灵
相关文章推荐
- Google Service Unity Plugin
- Unity3D Pattern not found 破解失败解决方法
- Unity 3D追踪效果的实现 目标箭头指引
- unity Dotween插件的简单介绍及示例代码
- 【Unity】实现Android手机震动的sdk接口
- UnityShader实战 之 体积光的实现
- 解决【unity3d】播放视频的两种操作方式
- Unity 球体表面平均分割点
- Unity开发心路历程——制作画板
- Unity开发HTC vive 四、传送
- Unity 物体根据鼠标移动而转动(可用于物体的360度展示)(PC端)
- HOTween简单应用
- unity 编辑器软件报错 相关
- Unity开发HTC vive 三、远处拖动3D物体
- 【Unity3D入门教程】Unity3D简介、安装和程序发布
- 如何在 Ubuntu 16.10 的 Unity 8 上运行老式 Xorg 程序
- Unity XML的序列化和反序列化
- unity陀螺仪参数详解
- 腾讯开源手游热更新方案,Unity3D下的Lua编程
- 三分钟用Unity3D开发第一个HTC VIVE的VR程序