当前位置:网站首页>Unity asset import settings
Unity asset import settings
2022-04-23 20:34:00 【One Mr rabbit one】
Inherit AssetPostprocessor
Relevant settings are handled in advance OnPreprocessTexture
Post import processing OnPostprocessTexture
Complete code :
using Framework;
using UnityEditor;
using UnityEngine;
namespace Editor.Tools
{
public class ImportAssetSettings : AssetPostprocessor
{
private const string ISIMPORTED = "isImported";
private bool IsImported()
{
if (Application.isBatchMode) return true;
return !assetPath.StartsWith(Constants.ArtDirPath) || assetImporter.userData.EndsWith(ISIMPORTED);
}
private void OnPostprocessTexture(Texture2D texture)
{
assetImporter.userData = ISIMPORTED;
}
private void OnPreprocessTexture()
{
if(IsImported()) return;
TextureImporter textureImporter = (TextureImporter) assetImporter;
textureImporter.textureType = TextureImporterType.Sprite;
textureImporter.mipmapEnabled = false;
textureImporter.isReadable = false;
}
}
}
版权声明
本文为[One Mr rabbit one]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210548406386.html
边栏推荐
- 【栈和队列专题】—— 滑动窗口
- SQL Server Connectors By Thread Pool | DTSQLServerTP 插件使用说明
- 一. js的深拷贝和浅拷贝
- Commit and rollback in DCL of 16 MySQL
- Leetcode 1351. Negative numbers in statistical ordered matrices
- 三十一. `prototype`显示原型属性和`__proto__`隐式原型属性
- Preliminary understanding of cache elimination algorithm (LRU and LFU)
- Commit and ROLLBACK in DCL of 16mysql
- Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
- Development of Matlab GUI bridge auxiliary Designer (functional introduction)
猜你喜欢
【PTA】整除光棍
Modeling based on catiav6
C migration project record: modify namespace and folder name
RT-1052学习笔记 - GPIO架构分析
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
[latex] 5 how to quickly write out the latex formula corresponding to the formula
A login and exit component based on token
Commit and rollback in DCL of 16 MySQL
Elastic box model
How to protect ECs from hacker attacks?
随机推荐
2022dasctf APR x fat epidemic prevention challenge crypto easy_ real
Syntaxerror: unexpected token r in JSON at position 0
Resolve the eslint warning -- ignore the warning that there is no space between the method name and ()
LeetCode 1346、检查整数及其两倍数是否存在
SQL: query duplicate data and delete duplicate data
Click an EL checkbox to select all questions
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
PostgreSQL basic functions
Customize timeline component styles
LeetCode 116. Populate the next right node pointer for each node
Numpy - creation of data type and array
GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
Plato Farm元宇宙IEO上线四大,链上交易颇高
bounding box iou
Markdown < a > tag new page open link
Solve the Chinese garbled code of URL in JS - decoding
Scrapy教程 - (2)寫一個簡單爬蟲
LeetCode 232、用栈实现队列
Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
JSX syntax rules