Issue with OnClicked in IDetailCustomization

i have class FLevelStatsDetailsCustomization that inheritances from IDetailCustomization. In the CustomizeDetails method, I create custom row and add a Sbutton to it. The button has an OnClicked event to call back to LevelStatsDetailsCustomization::GenerateLevels. When the button is clicked, the method is called; however, the code does call the method GenerateLevelValues on SourceBatchComponent. It is just jumps back to the for line and exits out of the loop, since there is only ever one item being loop over.

In the debugger, I am able to see that ObjectsBeingCustomized, and StrongObjects contain one item which is the item that I am editing, and that item is a
UISLevelStats. I dont understand what I am doing wrong.

FReply FLevelStatsDetailsCustomization::GenerateLevels()
	TArray<UObject*> StrongObjects;
	CopyFromWeakArray(StrongObjects, ObjectsBeingCustomized);
	for (UObject* SourceComponent : StrongObjects)
		UISLevelStats* SourceBatchComponent = CastChecked<UISLevelStats>(SourceComponent);
	return FReply::Handled();

Here is ISLevelStats.h where i define UISLevelStats as a subclass of UObject

UCLASS(BlueprintType, meta = (DisplayThumbnail = "true"))
class  UISLevelStats : public UObject

My end goal is trying to get designers to edit some properties and click this button to auto filling data into the custom asset.


I have tried the IsA method to see if the engine see that SourceComponent is a UISLevelStats. The result of that method call was true, SourceComponent is a UISLevelStats, but I am just having issue downcasting to the UISLevelStats class

I have even tried UISLevelStats* SourceBatchComponent = Cast(SourceComponent); but that does not work