关于Unity中图片资源比大小多少的问题

原创文章如需转载请注明:转载自 & QQ群:【】 本文链接地址:
using UnityE
using System.C
using UnityE
/// &summary&
/// 批量图片资源导入设置
/// 使用说明: 选择需要批量设置的贴图,
/// 单击DuanMenu/Texture Import Settings,
/// 打开窗口后选择对应参数,
/// 点击Set Texture ImportSettings,
/// 稍等片刻,--批量设置成功。
/// &/summary&
public class TextureImportSetting : EditorWindow {
/// &summary&
/// 临时存储int[]
/// &/summary&
private int[] IntArray = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
//AnisoLevel
private int AnisoLevel = 1;
//Filter Mode
private int FilterModeInt = 0;
private string[] FilterModeString = new string[] { "Point", "Bilinear", "Trilinear" };
//Wrap Mode
private int WrapModeInt = 0;
private string[] WrapModeString = new string[] { "Repeat", "Clamp" };
//Texture Type
private int TextureTypeInt = 0;
private string[] TextureTypeString = new string[] { "Texture", "Normal Map", "GUI", "Refelection", "Cookie", "Lightmap", "Advanced" };
//Max Size
private int MaxSizeInt = 5;
private string[] MaxSizeString = new string[] { "32", "64", "128", "256", "512", "1024", "2048", "4096" };
private int FormatInt = 0;
private string[] FormatString = new string[] { "Compressed", "16 bits", "true color" };
/// &summary&
/// 创建、显示窗体
/// &/summary&
[@MenuItem("DuanMenu/Texture Import Settings")]
private static void Init()
TextureImportSetting window = (TextureImportSetting)EditorWindow.GetWindow(typeof(TextureImportSetting), true, "TextureImportSetting");
window.Show();
/// &summary&
/// 显示窗体里面的内容
/// &/summary&
private void OnGUI()
//AnisoLevel
GUILayout.BeginHorizontal();
GUILayout.Label("Aniso Level
AnisoLevel = EditorGUILayout.IntSlider(AnisoLevel, 0, 9);
GUILayout.EndHorizontal();
//Filter Mode
FilterModeInt = EditorGUILayout.IntPopup("Filter Mode", FilterModeInt, FilterModeString, IntArray);
//Wrap Mode
WrapModeInt = EditorGUILayout.IntPopup("Wrap Mode", WrapModeInt, WrapModeString, IntArray);
//Texture Type
TextureTypeInt = EditorGUILayout.IntPopup("Texture Type", TextureTypeInt, TextureTypeString, IntArray);
//Max Size
MaxSizeInt = EditorGUILayout.IntPopup("Max Size", MaxSizeInt, MaxSizeString, IntArray);
FormatInt = EditorGUILayout.IntPopup("Format", FormatInt, FormatString, IntArray);
if (GUILayout.Button("Set Texture ImportSettings"))
LoopSetTexture();
/// &summary&
/// 获取贴图设置
/// &/summary&
public TextureImporter GetTextureSettings(string path)
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureI
//AnisoLevel
textureImporter.anisoLevel = AnisoL
//Filter Mode
switch (FilterModeInt)
textureImporter.filterMode = FilterMode.P
textureImporter.filterMode = FilterMode.B
textureImporter.filterMode = FilterMode.T
//Wrap Mode
switch (WrapModeInt)
textureImporter.wrapMode = TextureWrapMode.R
textureImporter.wrapMode = TextureWrapMode.C
//Texture Type
switch (TextureTypeInt)
textureImporter.textureType = TextureImporterType.I
textureImporter.textureType = TextureImporterType.B
textureImporter.textureType = TextureImporterType.GUI;
textureImporter.textureType = TextureImporterType.R
textureImporter.textureType = TextureImporterType.C
textureImporter.textureType = TextureImporterType.L
textureImporter.textureType = TextureImporterType.A
//Max Size
switch (MaxSizeInt)
textureImporter.maxTextureSize = 32;
textureImporter.maxTextureSize = 64;
textureImporter.maxTextureSize = 128;
textureImporter.maxTextureSize = 256;
textureImporter.maxTextureSize = 512;
textureImporter.maxTextureSize = 1024;
textureImporter.maxTextureSize = 2048;
textureImporter.maxTextureSize = 4096;
switch (FormatInt)
textureImporter.textureFormat = TextureImporterFormat.AutomaticC
textureImporter.textureFormat = TextureImporterFormat.Automatic16
textureImporter.textureFormat = TextureImporterFormat.AutomaticT
return textureI
/// &summary&
/// 循环设置选择的贴图
/// &/summary&
private void LoopSetTexture()
Object[] textures = GetSelectedTextures();
Selection.objects = new Object[0];
foreach (Texture2D texture in textures)
string path = AssetDatabase.GetAssetPath(texture);
TextureImporter texImporter = GetTextureSettings(path);
TextureImporterSettings tis = new TextureImporterSettings();
texImporter.ReadTextureSettings(tis);
texImporter.SetTextureSettings(tis);
AssetDatabase.ImportAsset(path);
/// &summary&
/// 获取选择的贴图
/// &/summary&
/// &returns&&/returns&
private Object[] GetSelectedTextures()
return Selection.GetFiltered(typeof(Texture2D), SelectionMode.DeepAssets);
阅读(...) 评论()&>&Unity3D图片资源
Unity3D图片资源
上传大小:12.38MB
各种各样的Unity3D资源贴图,一幅图片里面都有好几帧连续动作的图片,比如格斗类,射击类,角色类等等
综合评分:5(8位用户评分)
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有6条
可以用,谢了
可以用,谢谢
不是分开的,还要其他工具分开,不过还是有帮助,
shifengyuan764
综合评分:
积分/C币:3
综合评分:
积分/C币:5
综合评分:
积分/C币:5
changlushun
综合评分:
积分/C币:3
综合评分:
积分/C币:5
tanmengwen
综合评分:
积分/C币:5
综合评分:
积分/C币:5
综合评分:
积分/C币:3
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
Unity3D图片资源
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
(仅够下载10个资源)
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
Unity3D图片资源关于下载图片占用内存的问题_unity3d吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:83,784贴子:
关于下载图片占用内存的问题收藏
我场景里一个下载100多张图片,每张大概200-300Kb左右,一共大概也就30MB的图片,但是下载完成显示在场景后,占用几乎2个G的内存,请问为什么。有什么解决办法吗?
火星学习unity3d,编程师就业薪资20k起,毕业=高薪就业,unity3d0基础学习,半年即可入职一线游戏/互联网公司,火星终身免费推荐就业.
两个G我勒个去, 显得很专业呀, 你可以用这个做宣传来体现你游戏的高大上呀.
在游戏外面200k导进游戏进去可不一定了,一般一张1024的图都4M的
你只是计算了图片的大小,但是内存是多方面的综合表现,渲染效果,半透贴图,shader效果,骨骼动画等等等多方面都会影响内存的
一个画面显示不到200张
没用到的图片要情空空
LZ说说怎么解决的呢
登录百度帐号博客数据丢失,刚恢复一年前的备份!--QQ群:
在这里我就不多赘述了。直接上操作。如下
首先。先选中我们的图集。然后在属性栏中讲TextureType修改成Advanced。如下图。
选完后我没在此设置属性。如下设置。按照图片设置即可。现在图集的大小是10.7M
我们设置好后。按红色箭头的那个Apply保存后。我们在看图集大小。如下
图集减少了几M。Unity中图集是按照长宽来计算大小的(OpenGL的原因)。所以。当你图集比较小时。根据你图集来设置是 或者258.具体情况具体定。按照长宽最大的那个值设定。
然后。有的时候用TP类软件打包的图集。会发现图集错误。按如上的方法设置一下。一般都能搞定。如果不能搞定。注意一下Txt坐标文本是否引用错了。
转载请注明: &
or分享 (0)
本站所有内容如未标明转载的内容,均为原创内容。转载请注明来源!他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)

我要回帖

更多关于 一年级比较大小 的文章

 

随机推荐