Missing * in non pointer arguments for UFUNCTION

I’ve just realized the problem now. Change “UNeuralNetwork& neuralNetwork” to “UNeuralNetwork* neuralNetwork”. When you’re referencing UObjects use pointers instead of references as the objects can be deleted and references can’t be null.

Okay, that seems to have worked. I wasn’t sure if pointers would be exposed in Blueprint as they don’t really have them but they do have references which is why I went that route

I’m trying to make a BlueprintCallable function in c++ with an actor component and a UENUM as arguments.

.h

UFUNCTION(BlueprintCallable)
	/**
	* This function is to be used at runtime to send the most recent frame data to the neural network.
	* @param neuralNetwork - Reference to the neural network to send the data to
	* @param netUsage - If it is being used to test or train the network
	*/
	void SendDataToNetwork(UNeuralNetwork &neuralNetwork, NetworkUse netUsage);

.cpp

void ULeapDataCollector::SendDataToNetwork(UNeuralNetwork &neuralNetwork, NetworkUse netUsage)
{
	// Switches the use of the function based on what is needed from it
	switch (netUsage) {

	case NetworkUse::Train:
		// Network is being trained by this data
		neuralNetwork.TrainIndex(this->trainingData.Last().data, this->trainingData.Last().gestureIndex);
		break;

	case NetworkUse::Runtime:
		// Network is being tested by this data or being used at runtime
		neuralNetwork.FeedForward(this->trainingData.Last().data);
		break;
	}
}

It keeps giving me this error message: Missing '*' in Expected a pointer type

No idea what is going wrong so any help would be useful

Remove “this->”. The function is inside the class and the code is in the scope of the function. Therefore using “this->” is not needed. For example, replace “this->trainingData.Last()” to “trainingData.Last()”. I hope this makes sense!

I just did that and it’s still giving that error

Edit: It’s giving me the error line being the declaration in the header file

Can you give me the full error?

Just tried completely deleting the definition in the cpp file and it still gave me that error