Why can't I have a UObject Reference as a UFunction Parameter?

anonymous_user_1cdfb710
Mon, 09 Sep 2019 21:02:49 +0000
Editor Scripting

I was trying to write a UFunction that takes a UObject reference as a parameter and realized it won’t compile.

Example

.h
UFUNCTION()
	void Reference_Parameter(UPARAM(ref) UObject& reference);

.cpp
void ATestFunction::Reference_Parameter(UPARAM(ref) UObject& reference)
{
	UE_LOG(LogTemp, Warning, TEXT("Function Called"));
}

This lead me to realize that I must be missing fundamental UObject knowledge.

Can someone please attempt to provide clarification/understanding?

Thank you.

3 posts - 1 participant