Returning Reference to Structure Not Working!

I have a TArray of USTRUCTs. I use these to draw a bunch of rectangles, and it works fine. All is exposed to Blueprints as well, which is where the problem is.

I have a function (FindRoomById) that gets a particular USTRUCT from my TArray, and for whatever reason I cannot get this to return a reference to the original item properly. So any changes made are not reflected in the source array. HOWEVER, within the function itself, I clearly have a reference and not a copy, because if I chance a value there (as shown in code below), it works and my color changes to Red.

Yet when I use the returned reference after calling the above function in Blueprints, nothing I do to the structure affects the original…for some reason, I always have a copy. What is going on? What am I missing? There must be something about the pointer dereferencing or my function parameter definitions that I’m missing, but I can’t find it.

Sample Code for Struct:

USTRUCT(BlueprintType)
struct ARMAPTOOLS_API FRoom
{
	GENERATED_BODY()
	
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
	int32 Id;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
	FVector Location;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
	int32 Width;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
	int32 Length;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
	int32 Height;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
	FLinearColor Color;

	FORCEINLINE FRoom();

	FORCEINLINE FRoom(int32 id, FVector location, int32 width, int32 length, int32 height);
};

Sample Code for Function to Get Reference to Item:

bool AARMapGenerator::FindRoomById(int32 id, FRoom& roomRef) {
	bool status = false;

	FRoom* ref = (GeneratedRooms.FindByPredicate(
		[&](FRoom otherRoom) {
			return otherRoom.Id == id;
		}
	));

	if(ref != nullptr) {
		ref->Color = FColor::Red.ReinterpretAsLinear();
		status = true;
	}

	roomRef = *ref;

	return status;
}

roomRef = *ref;
This is a copy. roomRef is a reference to whatever is passed into the function, not a reference to the content of ref (you cannot reseat a reference anyway). To do what you want to do you would have to have FRoom*& roomRef as the function parameter but UHT won’t let you do that for Blueprint. The quickest way to fix this in your case is to return the reference and have the status as out parameter. The Blueprint node won’t even change I think because by-ref parameters are displayed as output pins as well by default:

FRoom& AARMapGenerator::FindRoomById(int32 id, bool& status);