no instance of overloaded function

i keep getting this message no instance of overloaded function on my createdefaultsubobject


.cpp
#include "AI_Controller.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "AI_Character.h"
#include "UObject/UObjectGlobals.h"



void AAI_Controller::Possess(APawn * InPawn)
{

}

AAI_Controller::AAI_Controller()
{
BehaviorComp = CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviorComp"));
}

.h
#include "CoreMinimal.h"
#include "AIController.h"
#include "AI_Controller.generated.h"

/**
*
*/
UCLASS()
class PROJECTX_API AAI_Controller : public AAIController
{
GENERATED_BODY()

virtual void Possess(class APawn* InPawn) override;

UPROPERTY(transient)
class UBehaviorTreeComponent* BehaviorComp;

UPROPERTY(transient)
class UBlackboardComponent* BlackboardComp;

AAI_Controller();



};


Why don't you mention that you're developing with Unreal Engine libraries? That would help us solve your problem.

Also, post the verbatim error message.

__________________________

Some guesses (I emphasize these are guesses, no idea which will actually work):

Change
 
BehaviorComp = CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviorComp"));

to
 
BehaviorComp = ObjectInitializer.CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviorComp"));


This is also completely a guess, but following from https://forums.unrealengine.com/development-discussion/c-gameplay-programming/58232-problem-with-c-battery-tutorial
Remove the this parameter from your CreateDefaultSubobject call.


Try a combination of the above?
Last edited on
thanks sorry if i forgot to say i was using ue4 for my project and when i did the ObjectInitializer
it said it was undefined so i deleted it and removed the this paramter and it worked
Topic archived. No new replies allowed.