private void Start() { List <Assembly> assemblies = new List <Assembly>(); foreach (string assemblyName in BHPath.RootAssemblies) { var asName = new AssemblyName(); asName.Name = assemblyName; Assembly asm = Assembly.Load(asName); if (asm == null) { Debug.LogWarning("Unable to load " + assemblyName); continue; } assemblies.Add(asm); } m_parentDialog = GetComponentInParent <Dialog>(); m_parentDialog.Ok += OnOk; m_parentDialog.OkText = m_localization.GetString("ID_RTEditor_ImportFileDialog_Btn_Open", "Open"); m_parentDialog.IsOkVisible = true; m_parentDialog.CancelText = m_localization.GetString("ID_RTEditor_ImportFileDialog_Btn_Cancel", "Cancel"); m_parentDialog.IsCancelVisible = true; m_fileBrowser = GetComponent <FileBrowser>(); m_fileBrowser.DoubleClick += OnFileBrowserDoubleClick; m_fileBrowser.SelectionChanged += OnFileBrowserSelectionChanged; List <string> allowedExts = new List <string>(); List <FileIcon> icons = new List <FileIcon>(); Type[] importerTypes = assemblies.SelectMany(asm => asm.GetTypes().Where(t => t != null && t.IsClass && typeof(IFileImporter).IsAssignableFrom(t))).ToArray(); foreach (Type importerType in importerTypes) { if (importerType.IsAbstract) { continue; } try { IFileImporter fileImporter = (IFileImporter)Activator.CreateInstance(importerType); string ext = fileImporter.FileExt; ext = ext.ToLower(); if (!ext.StartsWith(".")) { ext = "." + ext; } if (m_extToFileImporter.ContainsKey(ext)) { if (m_extToFileImporter[ext].Priority > fileImporter.Priority) { continue; } } m_extToFileImporter[ext] = fileImporter; allowedExts.Add(ext); icons.Add(new FileIcon { Ext = ext, Icon = Resources.Load <Sprite>(fileImporter.IconPath) }); } catch (Exception e) { Debug.LogError("Unable to instantiate File Importer " + e.ToString()); } } m_fileBrowser.AllowedExt = allowedExts; m_fileBrowser.Icons = icons; }