Blueprint implementation does not work when objects are created via GetDefaultObject

I have a C++ class where I implement a function “clone” to create a copy of an object, and a “startup” function decorated with BlueprintNativeEvent. When I create a copy with “class.GetDefaultObject()->clone()”, its blueprint implementation never be fire and always goes into the C++ implementation. When I use NewObject, everything works fine.

QuestNodeObjective.cpp some codes:

UQuestNodeObjective* UQuestNodeObjective::clone_Implementation()
{
	UQuestNodeObjective* ret = NewObject<UQuestNodeObjective>();
	ret->_id = this->_id;
	ret->_desc = this->_desc;
	ret->_state = this->_state;
	ret->_isTraced = this->_isTraced;
	return ret;
}

void UQuestNodeObjective::startup_Implementation(UQuestComponent* component)
{
	
}

QuestLibrary.cpp for construct UQuestNodeObjective objects:


void UQuestLibrary::PostInitProperties()
{
	Super::PostInitProperties();

	for (auto it : _questClasses)
	{
		if (!it)
			continue;
		
		auto obj = NewObject<UQuest>(this, it); //will never fires event "startup" in blueprint  if 
 replaced this line to "it.GetDefaultObject()->clone() "
		UQuestLibrary::_mapping.Add(obj->getId(), obj);
	}
}

UQuest* UQuestLibrary::lookup(FName id)
{
	auto ptr = UQuestLibrary::_mapping.Find(id);
	if (ptr && ptr->IsValid())
		return ptr->Get();

	return nullptr;
}

UQuestComponent.cpp

void UQuestComponent::startupQuest(UQuest* quest)
{
	// ......
		for (auto it : node->getObjectives())
		{
			if (it->getState() != EQuestNodeObjectiveState::Active)
				continue;

			it->startup(this);  // fire event
		}
	// ......
}

This creates a new object of the native class UQuestNodeObjective, not of the blueprint class instance it may be called on.
Use NewObject with a class parameter, passing in the class of the current instance :

UQuestNodeObjective* ret = NewObject<UQuestNodeObjective>(GetOuter(), GetClass());

Yes, you’re right. I missed this. Thanks