If you get a weird compile bug it might be this

Might help others,

I was wondering why in Sam’s example his compiled fine just declaring

	UFUNCTION(Server, Reliable, WithValidation)
	void Server_MoveForward(float Val);

	UFUNCTION(Server, Reliable, WithValidation)
	void Server_MoveRight(float Val);

Where I was having to explicitly declare everything where I was trying to figure out the errors myself before following along when the doc’s say you dont need to.

	UFUNCTION(Server, Reliable, WithValidation)
	void Server_MoveForward(float Val);
	
	virtual bool Server_MoveForward_Validate(float Val);
	virtual void Server_MoveForward_Implementation(float Val);

	UFUNCTION(Server, Reliable, WithValidation)
	void Server_MoveRight(float Val);

	virtual bool Server_MoveRight_Validate(float Val);
	virtual void Server_MoveRight_Implementation(float Val);

Turns out if you have the additional declarations commented out in the header file it confuses the compiler (4.26 (visual studio 2019)) like example like below where I had been testing and you get loads of errors, you have to delete the commented out lines so it is just the two UFUNCTIONS as the first code comment above then it all works fine.

So if you are getting errors and have something like the below try deleting the comments (weird but I can reproduce it 100%)

	UFUNCTION(Server, Reliable, WithValidation)
	void Server_MoveForward(float Val);
	
	//virtual bool Server_MoveForward_Validate(float Val);
	//virtual void Server_MoveForward_Implementation(float Val);

	UFUNCTION(Server, Reliable, WithValidation)
	void Server_MoveRight(float Val);

	//virtual bool Server_MoveRight_Validate(float Val);
	//virtual void Server_MoveRight_Implementation(float Val);
1 Like

Very insightful post. I wonder why it’s not working?

A massive guess but I would suspect that in that UFUNCTION macro somewhere it’s passing Server_MoveForward as a parameter into a regex type expression that someone’s has accidently written to be greedy something like .*Server_MoveForward or some such, and it accidently matches the commented out lines as well and try’s to pull them into the compile in the wrong place. But that’s a huge guess I’ve not looked :slight_smile: