Skip to content

Instantly share code, notes, and snippets.

@TakaakiIchijo
Last active September 23, 2019 02:44
Show Gist options
  • Save TakaakiIchijo/35529cb73c7a2ae67956d5b172973b26 to your computer and use it in GitHub Desktop.
Save TakaakiIchijo/35529cb73c7a2ae67956d5b172973b26 to your computer and use it in GitHub Desktop.
ピクセルアート系ゲームなどでフォントファイルのテクスチャをパキッとするEditor処理(フィルタモードをBilinearからPointにする)
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;
}
}
}
}
@TakaakiIchijo
Copy link
Author

色々間違ってたので完全に治した

@TakaakiIchijo
Copy link
Author

直した2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment