private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo)
{
if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
{
throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
}
HashSet <UnityType> nativeClasses = CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo);
// List native classes found in scenes
foreach (string klassName in rcr.GetAllNativeClassesIncludingManagersAsString())
{
UnityType klass = UnityType.FindTypeByName(klassName);
if (klass != null && klass.baseClass != null)
{
nativeClasses.Add(klass);
if (strippingInfo != null)
{
if (!klass.IsDerivedFrom(GameManagerTypeInfo))
{
var scenes = rcr.GetScenesForClass(klass.persistentTypeID);
if (scenes != null)
{
foreach (var scene in scenes)
{
strippingInfo.RegisterDependency(klassName, scene);
if (scene.EndsWith(".unity"))
{
strippingInfo.SetIcon(scene, "class/SceneAsset");
}
else
{
strippingInfo.SetIcon(scene, "class/AssetBundle");
}
}
}
}
}
}
}
// Always include base classes of derived native classes.
HashSet <UnityType> nativeClassesAndBaseClasses = new HashSet <UnityType>();
foreach (var klass in nativeClasses)
{
var current = klass;
while (current.baseClass != null)
{
nativeClassesAndBaseClasses.Add(current);
current = current.baseClass;
}
}
return(nativeClassesAndBaseClasses);
}