private void DrawLicenseSettings() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label("License:", EditorStyles.miniBoldLabel); EditorGUILayout.BeginHorizontal(); string prevSelectedLicenseCode = _licenseCodeProperty.stringValue; _selectedLicense = LicenseSettings.Licenses.FirstOrDefault(x => string.Equals(x.Code, _licenseCodeProperty.stringValue)); if (_selectedLicense == null) { _selectedLicense = LicenseSettings.Licenses.FirstOrDefault(); _selectedLicenseIndex = 0; _selectedLicenseVersionIndex = 0; } else { _selectedLicenseIndex = LicenseSettings.Licenses.IndexOf(_selectedLicense); _selectedLicenseVersionIndex = Array.IndexOf(_selectedLicense.Versions, _licenseVersionProperty.stringValue); } var licenseNames = LicenseSettings.Licenses.Select(license => license.Name).ToArray(); _selectedLicenseIndex = EditorGUILayout.Popup(_selectedLicenseIndex, licenseNames); _selectedLicense = LicenseSettings.Licenses.ElementAt(_selectedLicenseIndex); _licenseCodeProperty.stringValue = _selectedLicense.Code; if (!string.Equals(prevSelectedLicenseCode, _licenseCodeProperty.stringValue)) { _selectedLicenseVersionIndex = 0; } if (_selectedLicense.Versions != null && _selectedLicense.Versions.Length > 0) { if (_selectedLicenseVersionIndex >= _selectedLicense.Versions.Length || _selectedLicenseVersionIndex < 0) { _selectedLicenseVersionIndex = 0; } _selectedLicenseVersionIndex = EditorGUILayout.Popup(_selectedLicenseVersionIndex, _selectedLicense.Versions, GUILayout.Width(80)); _licenseVersionProperty.stringValue = _selectedLicense.Versions[_selectedLicenseVersionIndex]; } else { _licenseVersionProperty.stringValue = string.Empty; } EditorGUILayout.EndHorizontal(); if (_selectedLicense == null) { VarwinStyles.Link(LicenseSettings.CreativeCommonsLink); } else { VarwinStyles.Link(_selectedLicense.GetLink(_licenseVersionProperty.stringValue)); } EditorGUILayout.EndVertical(); }