unity-addressable-importer
unity-addressable-importer copied to clipboard
Force add schema from template to rule target group
I've created a group template:
And all I wanna do is my rule target group will be create from this template but the code not work as I expected and always give me this warning, the new created group not have the schema of my group, it only have the BundledAssetGroupSchema. After deep dive into code I think this feature is must have so I create this RP, if you have time, please take a look at this.
I also think of force remove schema if template don't have that, but I'm not sure if it need so I just leave it there
@favoyang If you have time, please take a look at this. Thanks
I'm a little bit surprised at how ApplyToAddressableAssetGroup
is implemented, which only applies schema values for the group to the schema values found in the source template. If a schema (value) of the template doesn't include in the given group, it didn't get applied to it. It probably should rename to ApplyExistingSchemaValuesToAddressableAssetGroup
.
/// <summary>
/// Applies schema values for the group to the schema values found in the template
/// </summary>
/// <param name="group">The AddressableAssetGroup to apply the schema settings to</param>
public void ApplyToAddressableAssetGroup(AddressableAssetGroup group)
{
foreach (AddressableAssetGroupSchema schema in group.Schemas)
{
List<Preset> presets = SchemaPresetObjects;
foreach (Preset p in presets)
{
Assert.IsNotNull(p);
if (p.CanBeAppliedTo(schema))
{
p.ApplyTo(schema);
schema.Group = group;
}
}
}
}
Then I think forceAddSchemaFromTemplate is not an option. Just remove the boolean and let it run every time before ApplyToAddressableAssetGroup
. Thought?
I also think of force remove schema if template don't have that, but I'm not sure if it need so I just leave it there.
This is another feature, let's just leave it there.
Sorry for the very late reply. (I didn't get notification from this, or maybe I missed the mail). That's sound good. I will update my PR
@favoyang I know this was an very old PR but it still needed feature (I think so I update the code as the advice you gave me) so if you have time please take a look.
Will take an eye on this repo more and see if I can contribute more.
I will review it later this week. Thx.
:tada: This PR is included in version 0.15.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: