float ElementHeightCallback(int index) { var name = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index).FindPropertyRelative(k_ScalerName).stringValue; var height = EditorGUIUtility.singleLineHeight; ScalerProfileSettingInformation scalerProfileSettingInfo; m_ScalerProfiles.TryGetValue(name, out scalerProfileSettingInfo); if (scalerProfileSettingInfo != null && scalerProfileSettingInfo.showScalerProfileSettings) { height += scalerProfileSettingInfo.scalerSettingsInfos.Count * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing); AdaptivePerformanceScalerSettings settingsObject = new AdaptivePerformanceScalerSettings(); Type settingsType = settingsObject.GetType(); MemberInfo[] memberInfo = settingsType.GetProperties(); for (int i = 0; i < memberInfo.Length; i++) { if (memberInfo[i].Name == "AdaptiveShadowCascades") // ap-obsolete-001 due to renaming the property { continue; } ScalerSettingInformation scalerSettingInfo; var scalerSetting = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index).FindPropertyRelative($"m_{memberInfo[i].Name}"); string scalerName = scalerSetting.FindPropertyRelative(k_ScalerName).stringValue; scalerProfileSettingInfo.scalerSettingsInfos.TryGetValue(scalerName, out scalerSettingInfo); if (scalerSettingInfo.showScalerSettings && scalerSetting.FindPropertyRelative(k_ScalerEnabled).boolValue) { height += k_NumberOfScalerProperties * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing); } if (scalerName == s_AdaptiveFramerateMenu && QualitySettings.vSyncCount > 0) { if (scalerSettingInfo.showScalerSettings && !scalerSetting.FindPropertyRelative(k_ScalerEnabled).boolValue) // if before was not executed due to scaler not enabled, but we need the height. { height += k_NumberOfScalerProperties * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing); } height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } } } return(height); }
void DrawElementCallback(Rect rect, int index, bool isactive, bool isfocused) { SerializedProperty element = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; var name = element.FindPropertyRelative(k_ScalerName).stringValue; ScalerProfileSettingInformation scalerProfileSettingInfo; if (!m_ScalerProfiles.TryGetValue(name, out scalerProfileSettingInfo)) { scalerProfileSettingInfo = new ScalerProfileSettingInformation() { showScalerProfileSettings = false }; } rect.width -= 6; rect.height = EditorGUIUtility.singleLineHeight; scalerProfileSettingInfo.showScalerProfileSettings = EditorGUI.Foldout(rect, scalerProfileSettingInfo.showScalerProfileSettings, new GUIContent($"{name}"), true); if (scalerProfileSettingInfo.showScalerProfileSettings) { AdaptivePerformanceScalerSettings settingsObject = new AdaptivePerformanceScalerSettings(); Type settingsType = settingsObject.GetType(); MemberInfo[] memberInfo = settingsType.GetProperties(); rect.x += 10; rect.width -= 10; for (int i = 0; i < memberInfo.Length; i++) { if (memberInfo[i].Name == "AdaptiveShadowCascades") // ap-obsolete-001 due to renaming the property { continue; } var scalerSetting = element.FindPropertyRelative($"m_{memberInfo[i].Name}"); rect = DrawScalerSetting(rect, scalerSetting, m_IndexerActiveProperty.boolValue && !EditorApplication.isPlayingOrWillChangePlaymode, scalerProfileSettingInfo); } } m_ScalerProfiles[name] = scalerProfileSettingInfo; }