26
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Assetを全検索する

Last updated at Posted at 2015-01-13

UI用Textureなのにmipmapをtrueにしているものが無いか全検索して調べたかったので
全検索方法を調べました。

FindAssets

Unity4.5からAssetDatabase.FindAssetsが使える模様

public static string[] FindAssets(string filter);
public static string[] FindAssets(string filter, string[] searchInFolders);

filter

filterの書き方は
co 名前検索(たぶんcontains?)
l: ラベル
t: Objectのtype
になります。


FindAssets("co common l:ui t:Texture2D", ["Assets/Game/Images/","Assets/Resources"]);

Assets/以下の全Texture2Dを調べる例

    [MenuItem("FindMipMappedTexture")]
    private static void ShowAllSpriteSetting()
    {
        var guids = AssetDatabase.FindAssets("t:texture2D", null);
        foreach (var guid in guids)
        {
            string path = AssetDatabase.GUIDToAssetPath(guid);
            var textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
            if (textureImporter != null)
            {
                if (textureImporter.mipmapEnabled == true)
                {
                    Debug.Log("MipMapped Texture! " + path);
                }
            }
        }
    }


唐突にfilterなんてものが出てきて焦りますが、なかなか便利に使えそうですね。

26
21
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?