7502018d20
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using UnityEditor.AddressableAssets.Settings;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace UnityEditor.AddressableAssets.Build.AnalyzeRules
|
|
{
|
|
/// <summary>
|
|
/// Rule class to check resource dependencies for duplicates
|
|
/// </summary>
|
|
public class CheckResourcesDupeDependencies : BundleRuleBase
|
|
{
|
|
/// <inheritdoc />
|
|
public override bool CanFix
|
|
{
|
|
get { return false; }
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override string ruleName
|
|
{
|
|
get { return "Check Resources to Addressable Duplicate Dependencies"; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clear analysis and calculate built in resources and corresponding bundle dependencies
|
|
/// </summary>
|
|
/// <param name="settings">The current Addressables settings object</param>
|
|
/// <returns>List of results from analysis</returns>
|
|
public override List<AnalyzeResult> RefreshAnalysis(AddressableAssetSettings settings)
|
|
{
|
|
ClearAnalysis();
|
|
|
|
string[] resourceDirectory = Directory.GetDirectories("Assets", "Resources", SearchOption.AllDirectories);
|
|
List<string> resourcePaths = new List<string>();
|
|
foreach (string directory in resourceDirectory)
|
|
resourcePaths.AddRange(Directory.GetFiles(directory, "*", SearchOption.AllDirectories));
|
|
|
|
|
|
return CalculateBuiltInResourceDependenciesToBundleDependecies(settings, resourcePaths.ToArray());
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void FixIssues(AddressableAssetSettings settings)
|
|
{
|
|
//Do nothing. There's nothing to fix.
|
|
}
|
|
}
|
|
|
|
|
|
[InitializeOnLoad]
|
|
class RegisterCheckResourcesDupeDependencies
|
|
{
|
|
static RegisterCheckResourcesDupeDependencies()
|
|
{
|
|
AnalyzeSystem.RegisterNewRule<CheckResourcesDupeDependencies>();
|
|
}
|
|
}
|
|
}
|