How to set default value to "self"?

yes. This is works. Here my own example.

UFUNCTION(BlueprintCallable, 
	meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject")
)
static void TestDefaultToSelf(UObject* WorldContextObject) {
	UE_LOG(LogTemp, Warning, TEXT("[WC object] name = %s"), *(WorldContextObject->GetName()))
	AActor* Actor = Cast<AActor>(WorldContextObject);
	if (Actor != nullptr) {
		UE_LOG(LogTemp, Warning, TEXT("[WC object] is AActor"))
	}
}

It will create bp node TestDefaultToSelf with one hidden pin.
I called it in BP_ThirdPersonCharacter this way:
image
And got this results:
image
Now WorldContextObject became refrence to bp actor that calls it.
Hope it helps someone.

1 Like