protected override void Preprocess(string path, UnityEngine.Object obj) { LexiconRegistry reg = obj as LexiconRegistry; if (reg.assetDir.isValid) { string dir = AssetDatabase.GUIDToAssetPath(reg.assetDir); if (!dir.IsEmpty()) { dir = EditorAssetUtil.GetAssetRelativePath(dir); TextAsset[] assets = EditorAssetUtil.ListAssets <TextAsset>(dir, FileType.Text); AddAssets(reg, assets); } } }
private void AddAssets(LexiconRegistry reg, TextAsset[] assets) { List <AssetRef> list = new List <AssetRef>(); foreach (var a in assets) { if (a != reg.initial) { var r = new AssetRef(); r.SetPath(a); list.Add(r); } } reg.assets = list.ToArray(); EditorUtil.SetDirty(reg); }