internal void ShowPlatformIconsByKind(PlatformIconFieldGroup iconFieldGroup, bool foldByKind, bool foldBySubkind) { // All icons that are displayed here are serialized into a single map // So in the preset we can only exclude/include all icons using (var vertical = new EditorGUILayout.VerticalScope()) using (new EditorGUI.PropertyScope(vertical.rect, GUIContent.none, m_PlatformIcons)) { int labelHeight = 20; foreach (var kind in PlayerSettings.GetSupportedIconKinds(NamedBuildTarget.FromBuildTargetGroup(iconFieldGroup.targetGroup))) { iconFieldGroup.SetPlatformIcons(GetPlatformIcons(iconFieldGroup.targetGroup, kind, ref m_AllIcons), kind); } foreach (var kindGroup in iconFieldGroup.m_IconsFields) { EditorGUI.BeginChangeCheck(); var key = kindGroup.Key; if (foldByKind) { GUIContent kindName = new GUIContent( string.Format("{0} icons ({1}/{2})", key.m_Label, kindGroup.Key.m_SetIconSlots, kindGroup.Key.m_IconSlotCount), key.m_KindDescription ); Rect rectKindLabel = GUILayoutUtility.GetRect(kSlotSize, labelHeight); rectKindLabel.x += 2; key.m_State = EditorGUI.Foldout(rectKindLabel, key.m_State, kindName, true, EditorStyles.foldout); } else { key.m_State = true; } if (key.m_State) { kindGroup.Key.m_SetIconSlots = 0; foreach (var subKindGroup in kindGroup.Value) { subKindGroup.Key.m_SetIconSlots = PlayerSettings.GetNonEmptyPlatformIconCount(subKindGroup.Value.Select(x => x.platformIcon) .ToArray()); kindGroup.Key.m_SetIconSlots += subKindGroup.Key.m_SetIconSlots; if (foldBySubkind) { string subKindName = string.Format("{0} icons ({1}/{2})", subKindGroup.Key.m_Label, subKindGroup.Key.m_SetIconSlots, subKindGroup.Value.Length); Rect rectSubKindLabel = GUILayoutUtility.GetRect(kSlotSize, labelHeight); rectSubKindLabel.x += 8; subKindGroup.Key.m_State = EditorGUI.Foldout(rectSubKindLabel, subKindGroup.Key.m_State, subKindName, true, EditorStyles.foldout); } else { subKindGroup.Key.m_State = true; } if (subKindGroup.Key.m_State || !foldBySubkind) { foreach (var iconField in subKindGroup.Value) { SetPreviewTextures(iconField.platformIcon); iconField.DrawAt(); } } } } if (EditorGUI.EndChangeCheck()) { SetPlatformIcons(iconFieldGroup.targetGroup, key.m_Kind, iconFieldGroup.m_PlatformIconsByKind[key.m_Kind], ref m_AllIcons); } } } }