When using FKismetEditorUtilities::CreateBlueprint, Parent class default object and its variables are not what i set it to be, what am i doing wrong?

To give more information, i created a standalone plugin that is supposed to create a blueprint that inherits from a certain class, which works fine, it also should store the new blueprint in a specified folder on creation, which also works fine. But whenever i open the editor and place the blueprint in a level the variables that i set via c++ are usually null and require a reset to default to return to the variables i set originally.

It is almost as if my CDO is being overwritten or a default one is being created on top of mine.

How do someone edit a Class Default Object? Can someone please tell me.

Staff Member please

Show some code from where you create the blueprint and attempt to set the defaults. Without doing so what kind of answer are you hoping to get?

to be honest i found an answer to what the problem is and to elaborate on it when a blueprint is created and it inherits from a class, the default object such as a static mesh component(root component) of the blueprint will represent what ever the default of the class is set to in its constructor. So if it is null in the constructor it it will be null in editor

if (ClassToSpawnFrom != nullptr)
{
if (ensure(Package))
{
UObject* Default = SpawnerClass->GetDefaultObject();

			if (Default)
			{
				UProperty* Property = FindField<UProperty>(Default->GetClass(), "ClassToSpawn");

				APickupableSpawner* PickupableSpawner = NewObject<APickupableSpawner>();

				UObject* Object = Cast<UObject>(PickupableSpawner);

				FPropertyChangedEvent ClassPropertyEvent(Property);

				APickupableSpawner* NewSpawnerArchetype = Cast<APickupableSpawner>(Default);

				NewSpawnerArchetype->ClassToSpawn = ClassToSpawnFrom;

				Default->PostEditChangeProperty(ClassPropertyEvent);
				
				UObject* ObjToTest = ClassToSpawnFrom->GetDefaultObject();
				
				AActor* Actor = Cast<AActor>(ObjToTest);
				
				UStaticMeshComponent* StaticMeshComp = Cast<UStaticMeshComponent>(Actor->GetRootComponent());
				
				NewSpawnerArchetype->OriginalStaticMeshComponent->StaticMesh = StaticMeshComp->StaticMesh; 
				UObject* DefaultObject = Default;

				const FString FileName = Default->GetName();
				
				const TCHAR* ConfigName = *FileName;
				
				FConfigCacheIni Config(EConfigCacheType::Temporary);
				
				FConfigFile& NewFile = Config.Add(ConfigName, FConfigFile());

				Default->SaveConfig();
				
				if (UBlueprint* NewBP = FKismetEditorUtilities::CreateBlueprint(SpawnerClass, Package, NewAssetName, BPTYPE_Normal, UBlueprint::StaticClass(), UBlueprintGeneratedClass::StaticClass()))
				{
					FAssetEditorManager::Get().OpenEditorForAsset(NewBP);
				
					AssetRegistryModule.Get().AssetCreated(NewBP);
				
					Package->MarkPackageDirty();
				}