当前位置:网站首页>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
边栏推荐
- Numpy mathematical function & logical function
- ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
- High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?
- LeetCode 116. 填充每个节点的下一个右侧节点指针
- LeetCode 232、用栈实现队列
- LeetCode 994、腐烂的橘子
- Investigate why close is required after sqlsession is used in mybatties
- Syntax Error: TypeError: this. getOptions is not a function
- LeetCode 542、01 矩阵
- BMP JPEG picture to vector image contourtrace
猜你喜欢

16MySQL之DCL 中 COMMIT和ROllBACK

2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real

How to protect ECs from hacker attacks?

内网渗透之DOS命令

Some basic configurations in interlij idea

Automatically fill in body temperature and win10 task plan

Building the tide, building the foundation and winning the future -- the successful holding of zdns Partner Conference

RT-1052学习笔记 - GPIO架构分析

On BIM data redundancy theory

go-zero框架数据库方面避坑指南
随机推荐
vulnhub DC:1渗透笔记
Leetcode 232, queue with stack
Thirty What are VM and VC?
Solution to PowerDesigner's failure to connect to MySQL in x64 system
LeetCode 116. Populate the next right node pointer for each node
Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
Identification of bolt points in aerial photography based on perception
LeetCode 709、转换成小写字母
Devexpress 14.1 installation record
Commit and ROLLBACK in DCL of 16mysql
How to do after winning the new debt? Is it safe to open an account online
The ODB model calculates the data and outputs it to excel
Scrapy教程 - (2)寫一個簡單爬蟲
Leetcode 74. Search two-dimensional matrix
JDBC database addition, deletion, query and modification tool class
Leetcode 542, 01 matrix
Why does ES6 need to introduce map when JS already has object type
"Meta function" of tidb 6.0: what is placement rules in SQL?
Click an EL checkbox to select all questions
After route link navigation, the sub page does not display the navigation style problem