Last active
September 23, 2019 02:44
-
-
Save TakaakiIchijo/35529cb73c7a2ae67956d5b172973b26 to your computer and use it in GitHub Desktop.
ピクセルアート系ゲームなどでフォントファイルのテクスチャをパキッとするEditor処理(フィルタモードをBilinearからPointにする)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class FontTextureFilterModeToPointImportSetting : AssetPostprocessor | |
{ | |
//このパスに対象のフォントファイルを入れる// | |
private static readonly string FontAssetPath = "Assets/Fonts"; | |
static void OnPostprocessAllAssets( | |
string[] importedAssets, | |
string[] deletedAssets, | |
string[] movedAssets, | |
string[] movedFromAssetPaths) | |
{ | |
foreach (string assetPath in importedAssets) | |
{ | |
if (assetPath.Contains(FontAssetPath)) | |
{ | |
Font font = AssetDatabase.LoadAssetAtPath<Font>(assetPath); | |
var fontTexture = font.material.mainTexture; | |
fontTexture.filterMode = FilterMode.Point; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
色々間違ってたので完全に治した