bool IsAssignedToCustomAssetPack(AddressableAssetSettings settings, AddressableAssetGroup group, PlayAssetDeliverySchema schema, CustomAssetPackEditorInfo assetPack) { if (!schema.IncludeInAssetPack) { var bundledSchema = group.GetSchema <BundledAssetGroupSchema>(); string buildPath = bundledSchema.BuildPath.GetValue(settings); if (BuildPathIncludedInStreamingAssets(buildPath)) { Addressables.LogWarning($"Group '{group.name}' has 'Include In Asset Pack' disabled, but its build path '{buildPath}' will be included in StreamingAssets at build time. " + $"The group will be assigned to the streaming assets pack."); } return(false); } if (assetPack.DeliveryType == DeliveryType.InstallTime) { return(false); } return(true); }
void ShowAssetPacks(SerializedObject so, List <AddressableAssetGroupSchema> otherSchemas = null) { List <CustomAssetPackEditorInfo> customAssetPacks = Settings.CustomAssetPacks; int current = AssetPackIndex; string[] displayOptions = new string[customAssetPacks.Count]; for (int i = 0; i < customAssetPacks.Count; i++) { displayOptions[i] = $"{customAssetPacks[i].AssetPackName} ({customAssetPacks[i].DeliveryType})"; } SerializedProperty prop = so.FindProperty("m_AssetPackIndex"); if (otherSchemas != null) { ShowMixedValue(prop, otherSchemas, typeof(int), "m_AssetPackIndex"); } EditorGUI.BeginChangeCheck(); var newIndex = EditorGUILayout.Popup(m_AssetPackGUI, current, displayOptions); if (EditorGUI.EndChangeCheck()) { AssetPackIndex = newIndex; if (otherSchemas != null) { foreach (AddressableAssetGroupSchema s in otherSchemas) { PlayAssetDeliverySchema padSchema = s as PlayAssetDeliverySchema; padSchema.AssetPackIndex = newIndex; } } } if (otherSchemas != null) { EditorGUI.showMixedValue = false; } prop = so.FindProperty("m_IncludeInAssetPack"); if (otherSchemas != null) { ShowMixedValue(prop, otherSchemas, typeof(bool), "m_IncludeInAssetPack"); } EditorGUI.BeginChangeCheck(); bool newIncludeInAssetPack = EditorGUILayout.Toggle(m_IncludeInAssetPackGUI, IncludeInAssetPack); if (EditorGUI.EndChangeCheck()) { IncludeInAssetPack = newIncludeInAssetPack; if (otherSchemas != null) { foreach (AddressableAssetGroupSchema s in otherSchemas) { PlayAssetDeliverySchema padSchema = s as PlayAssetDeliverySchema; padSchema.IncludeInAssetPack = newIncludeInAssetPack; } } } if (AssetPackIndex == 0 && !IncludeInAssetPack) { EditorGUILayout.HelpBox("Will still be included if \"Content Packing & Loading\" > \"Build Path\" uses the Addressables.BuildPath or Application.streamingAssetsPath.", MessageType.Info); } if (otherSchemas != null) { EditorGUI.showMixedValue = false; } using (new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Manage Asset Packs", "Minibutton")) { EditorGUIUtility.PingObject(Settings); Selection.activeObject = Settings; } } }