C++ ufunction use int pointer for output

Hello,

I’m trying to use a int* as a parameter for my u function so that my return type can remain a bool but the function will modify the value of a passed int.

for instance:

 UFUNCTION(EditAnywhere, BlueprintReadWrite)
      bool CheckResult(AActor* target, int* result)
      {
           *result = 10;
           return false? *result<11:true;
      }

Then in blueprint i could just pass in an int variable for result which will then be modified.

Is there a way to do this without making a custom struct for the output?

You can do the following:

UFUNCTION(EditAnywhere, BlueprintReadWrite)
       bool CheckResult(AActor* target, UPARAM(Ref) int32& Result)
       {
            Result = 10;
            return Result<11 ? false : true;
       }

What this will do is make Result both an Input and an Output.
But if you only want to make int32 an output (and not an input), just remove the “UPARAM(Ref)” and that will make the Blueprint not have int32 as input (just output)

Just to add some more insight on this. Unreal will not let you pass int as a pointer to Blueprints.
non-const references (&) are treated by Unreal as output for Blueprint nodes.

Ah I understand, thank you for the insight!