private void PrefabsGUI() { using (new EditorGUILayout.HorizontalScope()) { var dir = GetDirectoryForAddingPrefab(); if (GUILayout.Button("Add Prefab")) { var path = EditorUtility.OpenFilePanel("Select Prefabs", dir, "prefab"); if (!string.IsNullOrEmpty(path)) { AddPrefab(UnityPath.ToAsset(path)); } } if (GUILayout.Button("Add Prefabs In Folder")) { dir = EditorUtility.OpenFolderPanel("Select Folder", dir, null); if (!string.IsNullOrEmpty(dir)) { foreach (var path in UnityPath.EnumerateFiles(dir, "*.prefab")) { AddPrefab(path); } } } } }
private void AddLanguageAssetFolder(string path) { var files = UnityPath.EnumerateFiles(path, "*.json"); var asset = new LanguageAsset { LanguageName = Path.GetFileNameWithoutExtension(path), TextAssets = files.Select(AssetDatabase.LoadAssetAtPath <TextAsset>).ToArray() }; var array = (LanguageAsset[])_languageAssets.GetValue(); var set = new HashSet <LanguageAsset>(array) { asset }; _languageAssets.SetValue(set.ToArray()); }