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
2.3 KiB
C#
62 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEditor.AddressableAssets.Settings;
|
|
using UnityEditor.SceneManagement;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.AddressableAssets.Build.AnalyzeRules
|
|
{
|
|
class BuildBundleLayout : BundleRuleBase
|
|
{
|
|
public override bool CanFix { get { return false; } }
|
|
public override string ruleName { get { return "Bundle Layout Preview"; } }
|
|
|
|
public override List<AnalyzeResult> RefreshAnalysis(AddressableAssetSettings settings)
|
|
{
|
|
ClearAnalysis();
|
|
|
|
if (!BuildUtility.CheckModifiedScenesAndAskToSave())
|
|
{
|
|
Debug.LogError("Cannot run Analyze with unsaved scenes");
|
|
m_Results.Add(new AnalyzeResult { resultName = ruleName + "Cannot run Analyze with unsaved scenes" });
|
|
return m_Results;
|
|
}
|
|
|
|
CalculateInputDefinitions(settings);
|
|
var context = GetBuildContext(settings);
|
|
RefreshBuild(context);
|
|
ConvertBundleNamesToGroupNames(context);
|
|
|
|
m_Results = (from bundleBuild in m_AllBundleInputDefs
|
|
let bundleName = bundleBuild.assetBundleName
|
|
from asset in bundleBuild.assetNames
|
|
select new AnalyzeResult { resultName = bundleName + kDelimiter + "Explicit" + kDelimiter + asset }).ToList();
|
|
|
|
if (m_ExtractData.WriteData != null)
|
|
{
|
|
m_Results.AddRange((from fileToBundle in m_ExtractData.WriteData.FileToBundle
|
|
from guid in GetImplicitGuidsForBundle(fileToBundle.Key)
|
|
let bundleName = fileToBundle.Value
|
|
let assetPath = AssetDatabase.GUIDToAssetPath(guid.ToString())
|
|
where AddressableAssetUtility.IsPathValidForEntry(assetPath)
|
|
select new AnalyzeResult
|
|
{resultName = bundleName + kDelimiter + "Implicit" + kDelimiter + assetPath}).ToList());
|
|
}
|
|
|
|
if (m_Results.Count == 0)
|
|
m_Results.Add(noErrors);
|
|
|
|
return m_Results;
|
|
}
|
|
|
|
[InitializeOnLoad]
|
|
class RegisterBuildBundleLayout
|
|
{
|
|
static RegisterBuildBundleLayout()
|
|
{
|
|
AnalyzeSystem.RegisterNewRule<BuildBundleLayout>();
|
|
}
|
|
}
|
|
}
|
|
}
|