Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baba-s/c1c3c739dc85711c701a700e2818c9a2 to your computer and use it in GitHub Desktop.
Save baba-s/c1c3c739dc85711c701a700e2818c9a2 to your computer and use it in GitHub Desktop.
using UnityEditor.AddressableAssets.Settings;
using UnityEditor.AddressableAssets.Settings.GroupSchemas;
using UnityEngine.ResourceManagement.Util;
public static class AddressablesAssetGroupTemplateEqualityComparer
{
public static bool IsEquals( AddressableAssetGroupTemplate template, AddressableAssetGroup group )
{
foreach ( var schemaObject in template.SchemaObjects )
{
switch ( schemaObject )
{
case BundledAssetGroupSchema schema:
if ( !IsEquals( group.GetSchema<BundledAssetGroupSchema>(), schema ) )
{
return false;
}
break;
case ContentUpdateGroupSchema schema:
if ( !IsEquals( group.GetSchema<ContentUpdateGroupSchema>(), schema ) )
{
return false;
}
break;
}
}
return true;
}
public static bool IsEquals( ContentUpdateGroupSchema a, ContentUpdateGroupSchema b )
{
if ( a.StaticContent != b.StaticContent ) return false;
return true;
}
public static bool IsEquals( BundledAssetGroupSchema a, BundledAssetGroupSchema b )
{
if ( a.Compression != b.Compression ) return false;
if ( a.IncludeInBuild != b.IncludeInBuild ) return false;
if ( !IsEquals( a.BundledAssetProviderType, b.BundledAssetProviderType ) ) return false;
if ( a.ForceUniqueProvider != b.ForceUniqueProvider ) return false;
if ( a.UseAssetBundleCache != b.UseAssetBundleCache ) return false;
if ( a.UseAssetBundleCrc != b.UseAssetBundleCrc ) return false;
if ( a.UseAssetBundleCrcForCachedBundles != b.UseAssetBundleCrcForCachedBundles ) return false;
if ( a.Timeout != b.Timeout ) return false;
if ( a.ChunkedTransfer != b.ChunkedTransfer ) return false;
if ( a.RedirectLimit != b.RedirectLimit ) return false;
if ( a.RetryCount != b.RetryCount ) return false;
if ( !IsEquals( a.BuildPath, b.BuildPath ) ) return false;
if ( !IsEquals( a.LoadPath, b.LoadPath ) ) return false;
if ( a.BundleMode != b.BundleMode ) return false;
if ( !IsEquals( a.AssetBundleProviderType, b.AssetBundleProviderType ) ) return false;
if ( a.BundleNaming != b.BundleNaming ) return false;
return true;
}
public static bool IsEquals( SerializedType a, SerializedType b )
{
if ( a.AssemblyName != b.AssemblyName ) return false;
if ( a.ClassName != b.ClassName ) return false;
return true;
}
public static bool IsEquals( ProfileValueReference a, ProfileValueReference b )
{
if ( a.Id != b.Id ) return false;
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment