Functions with ustructs pointer as parameter, OtherCompilationError(5)

I am trying to write a function that takes a structure I created, and fills it :



USTRUCT(BlueprintType)
struct F_Int_2D_Vector
{
	GENERATED_USTRUCT_BODY()
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "F_Int_2D_Vector Struct")
	int32 X;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "F_Int_2D_Vector Struct")
	int32 Y;

	F_Int_2D_Vector() { X = -1; Y = -1; }
	F_Int_2D_Vector(int32 xx, int32 yy)
	{
		X = xx;
		Y = yy;
	}
};


I Can use this structure in the c++ and it works fine, I can also see this structure/ break it in the blueprint

This is the class definition:



UCLASS()
class TD_API AGridSolver : public AActor
{
	GENERATED_BODY()
private:
	The_Pather *my_pather;
public:
	// Sets default values for this actor's properties
	AGridSolver();
	TArray<F_Int_2D_Vector> result;

	virtual void BeginPlay() override;
	virtual void Tick(float DeltaSeconds) override;

	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Solve Grid", CompactNodeTitle = "Solve Grid", Keywords = "Solve Grid"), Category = Game)
	void SolveGrid(int32 start_x, int32 start_y, int32 finish_x, int32 finish_y, F_Int_2D_Vector *result);

	UFUNCTION(BlueprintCallable, meta = (DisplayName = "Setup Grid", CompactNodeTitle = "Setup Grid", Keywords = "Setup Grid"), Category = Game)
	TArray<int> setup_grid(TArray<FString> grid);

};


This is the function definition



 void AGridSolver::SolveGrid(int32 start_x, int32 start_y, int32 finish_x, int32 finish_y, F_Int_2D_Vector *result)
{
	my_pather->SolveGrid(start_x,start_y, finish_x, finish_y);

}


if i take out the last parameter from the function declaration it compiles fine if i add it i get OtherCompilationError(5)

AFAIK you are not allowed to pass USTRUCTS by pointer, especially when its blueprintcallable. Pass it by reference instead.
Also the output window in visual studio should tell you this.

Yup that’s correct, USTRUCTS can’t be passed this way though Blueprint functions. It will work with regular C++ functions, though.

You can’t safely store pointers to structs as member variables either.