BlueprintePure=False metadata not working as expected

I noticed in the 4.12 release notes that BlueprintPure metadata was added: “New: Added “BlueprintPure=false” metadata to allow const functions to be exposed to Blueprints as non-pure.”

I’ve tried to use this in my code, but the node still appears as a BP Pure node.

UFUNCTION(BlueprintCallable, Category = "Faction|ShipSet", meta=(BlueprintPure = false))
TArray<TSubclassOf<class AUnitPawn>> GetShipSet() const;

98975-blueprintpurefalse.jpg

I was hoping to be able to use a const function without needing to create a local copy to avoid doing the same work during a “Get” (const correctness is important in our project).

Am I using it wrong, or am I otherwise misunderstanding the purpose of the flag?

Thanks in advance :slight_smile:

Not seeing that as a valid meta specifier: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums and after a quick server of the engine the meta specifier meta=(BlueprintPure = false) wasn’t find in use.

How did you find that? Did you get it to work?

For future reference, I had learned about this from the 4.12 notes: “New: Added “BlueprintPure=false” metadata to allow const functions to be exposed to Blueprints as non-pure.”

I’ve recently tried it in 4.17 and it is functional (it was quite possibly functional in 4.12 but I wasn’t using it correctly.)

eg.

  //This function is C++ const but not BP pure
  UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "GameData")
  void GetUnitDataRow(const FName& UnitName, bool& OutFound, FDataTable_Units& OutUnitRow) const;

ahh okay. That makes sense. I’ve updated A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums with the correct information.

Just a side note. This will not work!

UFUNCTION(BlueprintCallable, meta=(BlueprintPure = false))

You need to move “BlueprintPure” outside of the meta block like this:

UFUNCTION(BlueprintCallable, BlueprintPure=false)

2 Likes