Error when trying to use float pointers?

I got this problem in my code. I try to make a pointer to a float so i can add the reference to in the editor.

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class MYPART_API UMyActorComponent : public UActorComponent
{
          //...


	public:
	//The direction of the character
	UPROPERTY(EditAnywhere)
		float * direction = nullptr;

	//Player to follow
	UPROPERTY(EditAnywhere)
		AActor * player = nullptr;

};

All the header code:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "MyActorComponent.generated.h"


UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class MYPART_API UMyActorComponent : public UActorComponent
{
	GENERATED_BODY()

public:
	// Sets default values for this component's properties
	UMyActorComponent();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

public:
	//The direction of the character
	UPROPERTY(EditAnywhere)
		float * direction = nullptr;

	//Player to follow
	UPROPERTY(EditAnywhere)
		AActor * player = nullptr;

};

Comes with the error:

Inappropriate ‘*’ on variable of type
‘float’, cannot have an exposed
pointer to this type.

I just want a simple float pointer… why?!
Has it something to do with how UPROPERTY works?

that is because you have declared it as a UPROPERTY.

UE4 type system doesn’t allow float pointers (and there is honestly no reason for using them).

you are free to use float pointers as non UPROPERTY (just regular C++ float pointers instead).

UPROPERTY is basically for displaying that variable in BP, or replicating that over network.