Add new AnalysisRule

Hi, I’ve created a new Analysis rule I need for the correct bundle management on my project. When I put this script on the PackageCache/Addressables folfer, it works properly, but the problem is that when Unity restarts, this script is deleted.

There is a way to put my custom Analysis rule on the Assets folder? I need it in order to add it to control version, and it doesn’t work because BundleRuleBase is an internal class.

Thank you.

I guess, you have to copy the Library/PackageCache/Addressables to Packages/Addressables, to make a local package which is mutable. Then delete the addressable line in Packages/manifest.json.

…until unity dev make the internal class public.

Rather than copy the entire package, I’d copy BundleRuleBase.cs to your project, and rename it. Then you can customize it to your hearts content. It’s possible that BRB is also accessing internal things, but that shouldn’t be the case. so if copying it doesn’t work, there’s probably some things we need to expose.

BundleRuleBase makes a call to BuildScriptPackedMode.PrepGroupBundlePacking, which is marked as internal, so BundleRuleBase can’t be copied and used.

Having same issue metioned by joe_nk. Also it calls AddressableAssetUtility.IsPathValidForEntry which is internal as well.

I ended up copying those functions as well, and not sure if they’re going to be changed when addressables version goes up. It would’ve been much easier if addressables team exposed BuildRuleBase and make it extensible.

Additionally: AnalyzeRule.m_Results is internal… and it seems like it should be changed from derived classes. I mean I can just make other member variable that does the same, but why have serializable variable that will not be modified in derived classes other than built in classes?

yeah I had to copy a whole bunch of stuff too, and I’m going to need to repeat the process when addressables is next updated, incase those methods have changed, like you said. as far as I can tell, m_results isn’t actually needed. so not sure what it’s there for