//will get called every time the asset changes //if one assets gets set to active, disable others, be careful to not run into an endless loop here private void OnValidate() { if (isActiveSetting) { List <ModelImporterSettingSO> allSettings = ImporterExtensions.FindAssetsByType <ModelImporterSettingSO>(); for (int i = 0; i < allSettings.Count; i++) { if (allSettings[i] != this) { allSettings[i].isActiveSetting = false; } } } }
//check for updated settings for every import private void ApplyImporterSOSettings() { var settingsList = ImporterExtensions.FindAssetsByType <ModelImporterSettingSO>(); if (settingsList != null) { for (int i = 0; i < settingsList.Count; i++) { var setting = settingsList[i]; if (setting.isActiveSetting) { importMaterials = setting.ImportMaterials; generateColliders = setting.GenerateColliders; generateLightmapUVs = setting.GenerateLightmapUVs; break; } } } }