当前位置:网站首页>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
边栏推荐
- Solution to PowerDesigner's failure to connect to MySQL in x64 system
- XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
- Some basic configurations in interlij idea
- Es error: request contains unrecognized parameter [ignore_throttled]
- 2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
- Experience of mathematical modeling in 18 year research competition
- Scripy tutorial - (2) write a simple crawler
- [graph theory brush question-4] force deduction 778 Swimming in a rising pool
- The problem of 1 pixel border on the mobile terminal
- ABAQUS script email auto notification
猜你喜欢
go-zero框架数据库方面避坑指南
Numpy - creation of data type and array
[PTA] l1-002 printing hourglass
Go zero framework database avoidance Guide
Livego + ffmpeg + RTMP + flvjs to realize live video
【栈和队列专题】—— 滑动窗口
Imitation Baidu map realizes the three buttons to switch the map mode by automatically shrinking the bottom
16MySQL之DCL 中 COMMIT和ROllBACK
Tensorflow 2 basic operation dictionary
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
随机推荐
Solve the Chinese garbled code of URL in JS - decoding
Preliminary understanding of cache elimination algorithm (LRU and LFU)
BMP JPEG picture to vector image contourtrace
Scripy tutorial - (2) write a simple crawler
【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
LeetCode 116. 填充每个节点的下一个右侧节点指针
XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
Come in and teach you how to solve the problem of port occupation
Development of Matlab GUI bridge auxiliary Designer (functional introduction)
JDBC tool class jdbcconutil gets the connection to the database
star
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
What is the difference between a host and a server?
【PTA】整除光棍
UnhandledPromiseRejectionwarning:CastError: Cast to ObjectId failed for value
Easy to use nprogress progress bar
16MySQL之DCL 中 COMMIT和ROllBACK
打新债中签以后怎么办,网上开户安全吗
Vscode download speed up
How do BIM swindlers cheat? (turn)