List <AddressableAssetGroupSchema> GetSchemasForOtherTargets(AddressableAssetGroupSchema schema) { List <AddressableAssetGroupSchema> values = m_GroupTargets .Where(t => t.HasSchema(schema.GetType()) && t != m_GroupTarget) .Select(t => t.GetSchema(schema.GetType())).ToList(); return(values); }
/// <summary> /// Called per group per schema to evaluate that schema. This can be an easy entry point for implementing the /// build aspects surrounding a custom schema. Note, you should not rely on schemas getting called in a specific /// order. /// </summary> /// <param name="schema">The schema to process</param> /// <param name="assetGroup">The group this schema was pulled from</param> /// <param name="aaContext">The general Addressables build builderInput</param> /// <returns></returns> protected virtual string ProcessGroupSchema(AddressableAssetGroupSchema schema, AddressableAssetGroup assetGroup, AddressableAssetsBuildContext aaContext) { var playerDataSchema = schema as PlayerDataGroupSchema; if (playerDataSchema != null) { return(ProcessPlayerDataSchema(playerDataSchema, assetGroup, aaContext)); } var bundledAssetSchema = schema as BundledAssetGroupSchema; if (bundledAssetSchema != null) { return(ProcessBundledAssetSchema(bundledAssetSchema, assetGroup, aaContext)); } return(string.Empty); }
void ImportSchemasInternal(AddressableAssetSettings settings, string groupName, string schemaFolder) { if (string.IsNullOrEmpty(schemaFolder) || !Directory.Exists(schemaFolder)) { Debug.LogError($"Schema folder path is not a valid folder '{schemaFolder}'. Schemas will not be imported."); return; } AddressableAssetGroup group = settings.FindGroup(groupName); if (group == null) { Debug.LogError($"Settings does not contain group '{groupName}'. Schemas will not be imported."); return; } string[] schemaPaths = Directory.GetFiles(schemaFolder); foreach (string unparsedPath in schemaPaths) { if (Path.GetExtension(unparsedPath).ToLower() != ".asset") { continue; } string path = unparsedPath.Replace("\\", "/"); AddressableAssetGroupSchema schema = AssetDatabase.LoadAssetAtPath <AddressableAssetGroupSchema>(path); if (schema == null) { Debug.LogError($"Cannot load schema asset at '{path}'. Schema will not be imported."); continue; } if (schema is BundledAssetGroupSchema bundledSchema) { List <string> variableNames = schema.Group.Settings.profileSettings.GetVariableNames(); SetBundledAssetGroupSchemaPaths(settings, bundledSchema.BuildPath, AddressableAssetSettings.kLocalBuildPath, "LocalBuildPath", variableNames); SetBundledAssetGroupSchemaPaths(settings, bundledSchema.LoadPath, AddressableAssetSettings.kLocalLoadPath, "LocalLoadPath", variableNames); } group.AddSchema(schema); } }