Download

FString, c++ to BP and back

Hey all, I am trying to create an FString variable in c++ that i can GET and SET from blueprints.

I have this:

//.h

	UFUNCTION(BlueprintCallable, Category = "VPDATA")
		static FString SelectionSET(FString Selection);

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VPDATA")
		FString SelectedItem;

//.cpp

FString UListDataObject::SelectionSET(FString Selection)
{
SelectedItem->Selection;

}

which is wrong… Do I need a UFUNCTION for this? Or can i just somehow set a var that is Blueprint set/get-able?

Thanks!

Well im no expert but i think it should work. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “VPDATA”) should allow you to change the variable inside blueprint.

That’s what i thought… But it refuses to show up!

ACtually… now it is there. weird. BUT, Is it possible to make a static FString?

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “VPDATA”)
static FString SelectedItem;

…would mean that I don’t need a target in the BP graph.

Aha, sorted. I was setting the Variable in a UOBJECT class. Moved to an Actor class and I can get it as a target node.

thanks for your help!