Im trying to make an HTTPComponent attach to a floating pawn.
My header file for the pawn looks like this:
#include "InputActionValue.h"
#include "Player/FLCameraController.h"
#include "Vehicle/VehicleComp.h"
#include "Inventory/InventoryComp.h"
#include "Networking/HTTPComp.h"
#include "CoreMinimal.h"
#include "EnhancedInputComponent.h"
#include "GameFramework/Pawn.h"
#include "Blueprint/UserWidget.h"
#include "FLCameraPawn.generated.h"
public:
// Sets default values for this pawn's properties
AFLCameraPawn();
virtual void Tick(float DeltaSeconds) override;
UPROPERTY(EditAnywhere,BlueprintReadOnly)
APlayerController* AsPlayerController;
UPROPERTY(EditAnywhere,BlueprintReadOnly)
AFLCameraController* AsFLCameraController;
UPROPERTY(EditAnywhere,BlueprintReadWrite)//important component.
UHTTPComp* HTTPCompVariable;
The cpp file for the pawn looks like this:
AFLCameraPawn::AFLCameraPawn()
{
PrimaryActorTick.bCanEverTick = true;
AActor::SetReplicateMovement(true);
SetReplicates(true);
bAlwaysRelevant = true;
HTTPCompVariable = CreateDefaultSubobject<UHTTPComp>(TEXT("HTTPComp"));
}
void AFLCameraPawn::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if(bDebugMode)
{
if(HTTPCompVariable)
{
GEngine->AddOnScreenDebugMessage(7, 0.1f, FColor::Red, FString::Printf(TEXT("Is replacement host: %s"),(HTTPCompVariable->bIsReplacementHost ? TEXT("true"):TEXT("false"))));
}
}
}
The HTTP has 2 functions and a simple boolean variable. Nothing worth showing here unless its detrimental to solving the problem.
The problem:
HTTPCompVariable returns invalid after creation in constructor. THIS TIME, i HAVE used UPROPERTY(), UPROPETY(EditAnywhere, VisibleAnywhere, EditDefaultsOnly, EditAnywhere, BlueprintReadWrite, AND BlueprintReadOnly) Basically every possible combination of UPROPERTY onto pointers. I have also tried removing the UPROPERTY entirely.
Please, any help is much appreciated. I cant exactly work on UE5 if i cant even use components.