NewObject using a Blueprint class?

Correct me if I’m wrong, but by no longer using CharacterSkills[index] in NewObject<>()

I believe this will only create a UBaseSkill object and assign it the name of your BP, not creating the actual BP class.

TSubclassOf is a pointer to a class, which in this instance specifies what subclass of UBaseSkill you would like to create.

An example from my own project:



UAITask_Base& UAITasksManager::CreateTask(TSubclassOf<UAITask_Base> inClass, EAITaskPriority priority, bool activate, FName name, ETask inTaskContext)
{
    UAITask_Base* task = NewObject<UAITask_Base>(this, inClass);
    task->SetInstanceName(name);
    task->InitAITask(*owner->GetThisAIController(), *this, (uint8)priority);

    //We need to initialize task here as well since this can be used to create task outside of manager
    //If CreateTask() is called by manager, then this functionality will be overridden
    task->InitializeTask(owner, owner->currentManager, inTaskContext);

//    UE_LOG(LogTemp, Log, TEXT("%s is creating a task of %s, address is %d. AITasksManager::CreateTask()"), GetOwner() ? *GetOwner()->GetName() : TEXT("Owner Unknown"), inClass ? *inClass->GetName() : TEXT("class Unknown"), task);
//    UE_LOG(LogTemp, Log, TEXT("Task class is %s. AITasksManager::CreateTask()"), task ? *task->GetName() : TEXT("task Unknown"));

    if (activate)
    {
        task->VisualLogAndLog(FString::Printf( TEXT("%s is activating a task of %s. AITasksManager::CreateTask()"), GetOwner() ? *GetOwner()->GetName() : TEXT("Owner Unknown"), inClass ? *inClass->GetName() : TEXT("class Unknown")));

        AddTaskReadyForActivation(*task);
    }

    return *task;
}


Has the OP verified the objects created are of the actual BP, and not just using the names?