Do references of Classes keep an asset loaded?

So i’m trying to figure out if all this work in my custom asset manager could have been a lot easier. When a reference to an UClass object is a variable of a loaded type, is that asset that the UClass belongs to loaded?

For reference, My Asset Manager maps FSoftObjectPtrs via the FAssetData.AssetName. The idea was to make it work kinda like Primary Assets except more usable and I have no idea what Primary Assets are actually good for. And the documentation for primary assets leaves much to be desired.

Anyway that plan is to be able to save the “Key” of a tracked asset and then load it later and spawn it in the world without explicitly knowing exactly what it is.

This is the implementation. It works. I’m just not sure if I could/should replace the mapped FSoftObjectPtr with UClass and can simplify everything else?

void UPrivateerAssetManager::StartInitialLoading()
{
	Super::StartInitialLoading();
	
	TArray<FString> scanPaths = 
	{
		"/Game/Tracked"
	};
	
	auto& assetRegistry = GetAssetRegistry();
	assetRegistry.ScanPathsSynchronous(scanPaths, true);
	TArray<FAssetData> assetDataArray;
	
	FARFilter assetFilter;
	for (auto scanPath : scanPaths)
	{
		assetFilter.PackagePaths.Add(FName(*scanPath));
	}
	assetFilter.bRecursivePaths = true;
	//assetFilter.bIncludeOnlyOnDiskAssets = !GIsEditor; // In editor check in memory, otherwise don't
	
	assetRegistry.GetAssets(assetFilter, assetDataArray);
	for (auto& assetData : assetDataArray)
	{
		auto assetClass = assetData.GetClass();
	
		auto foundType = TrackedAssetTypeMap.Find(assetData.AssetName);
		if (!foundType)
		{
			FSoftObjectPath assetPath = GetAssetPathForData(assetData);
			ensure(assetPath.IsAsset());
			
			auto mappedAsset = MakeShareable(new FSoftObjectPtr(assetPath));
			foundType = &TrackedAssetTypeMap.Add(assetData.AssetName, mappedAsset);
		}
	}
}

FName UPrivateerAssetManager::GetTrackedAssetKey(UClass* trackedClass)
{
	auto assetManager = Cast<UPrivateerAssetManager>(&Get());
	auto name = FPackageName::GetShortFName(trackedClass->GetOutermost()->GetName());
	if (assetManager->TrackedAssetTypeMap.Contains(name))
		return name;
	return NAME_None;
}

UObject* UPrivateerAssetManager::GetTrackedAssetObject(FName trackedAssetName)
{
	auto assetManager = Cast<UPrivateerAssetManager>(&Get());
	auto mappedAssetRef = assetManager->TrackedAssetTypeMap.Find(trackedAssetName);
	if (mappedAssetRef)
	{
		auto softObjectRef = mappedAssetRef->Get();
		TSharedPtr<FStreamableHandle> NewHandle = assetManager->StreamableManager.RequestSyncLoad({ softObjectRef.ToSoftObjectPath() }, false, trackedAssetName.ToString());
		auto newObject = softObjectRef.Get();
		return newObject;
	}

	return nullptr;
}

TSubclassOf<UObject> UPrivateerAssetManager::GetTrackedAssetClass(FName trackedAssetName)
{
	return Cast<UClass>(GetTrackedAssetObject(trackedAssetName));
}