void UTestActorComponent::TestFunction()
{
UE_LOG(LogTemp, Warning, TEXT("Did This call Twice?"));
}
This is the code in the Char Controller.
#include "NPC/NPCBase.h"
#include "NPC/UtilityAIBrain.h"
#include "NPC/Actions/WanderAction.h"
#include "AIController.h"
#include "NPC/TestActorComponent.h"
#include "NPC/BaseObject.h"
// Sets default values
ANPCBase::ANPCBase()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
NPCAIController = Cast<AAIController>(GetController());
NPCBrain = CreateDefaultSubobject<UUtilityAIBrain>(TEXT("The Brain"));
TestComp = CreateDefaultSubobject<UTestActorComponent>(TEXT("TestComponent"));
BaseObject1 = CreateDefaultSubobject<UBaseObject>(TEXT("BaseObject"));
}
// Called when the game starts or when spawned
void ANPCBase::BeginPlay()
{
Super::BeginPlay();
BaseObject1->Testing();
TestComp->TestFunction();
}
}
I have been testing with a few different components and parent classes, so lots more includes then nessisary
Please do not apologize you are helping me. I thought it was missing one but these days I just assume everyone knows more then me. But SOB that did the job.
There was a second copy of the char blueprint hiding outside the visible area. Hence it was showing as called twice. FACEPALM