目录
前言:生气!!!昨天明明修改之后也点击了发布,今天早上一看文章的修改没有了!!!主要是工作中需要将所有含有text的gameobject挂上组件localize。
获取所有符合条件的对象
AssetDatabase.FindAssets
public static string[] FindAssets(string filter); public
static string[] FindAssets(string filter, string[] searchInFolders);
filter直接用字符串是搜文件名中的关键字,使用“l:key”是标签为key的,“t:key”是类型为key
的,下面是官方的两个例子,看第二个就知道用法,过滤条件是&&。
@MenuItem("Test/FindAssetsUsingSearchFilter")
static function FindAssetsUsingSearchFilter ()
{
// Find all assets labelled with 'concrete' :
var guids = AssetDatabase.FindAssets ("l:concrete", null);
for (var guid in guids)
Debug.Log (AssetDatabase.GUIDToAssetPath(guid));
// Find all Texture2Ds that have 'co' in their filename, that are labelled with 'concrete' and 'architecture' and are placed in 'MyAwesomeProps' folder
var guids2 = AssetDatabase.FindAssets ("co l:concrete l:architecture t:texture2D", ["Assets/MyAwesomeProps"]);
for (var guid in guids2)
Debug.Log (AssetDatabase.GUIDToAssetPath