Skip RPC validation

Hello, I need to add a couple of RPCs into my game, however I do not require in any way for these RPCs to be validated (they do not process any key game information). The compiler though demands me to use the validation anyway and won’t compile. This really just slows down my work and it’s really annoying especially when dealing with multiple RPCs. Is there a way to bypass/disable the warning and let the code compile without using the validation on every single RPC I add?

From my own experience and research on this topic, the answer is no.

When defining server or client UFUNCTIONs in c++, the “WithValidation” option is required, and there is no “WithoutValidation” option allowed.

You must create the corresponding validation function

bool MyFunction_Validate()
{
  return true;
}

in your c++ file. Even if you have no plans on using it.

To extend on what TX.AlphaMale is saying:

The Validate call for Server functions is required, which is displayed in the compiling error if you do not have WithValidation:

Server RPC missing 'WithValidation' keyword in the UPROPERTY() declaration statement.  Required for security purposes.

it is truly awful. it hurts the performance and the development speed. at least Epic could generate one default returning true for us…

Do you have some tests showing how much performance is being lost when it simply returns true? Sounds like you don’t approve of the whole authoritative server setup where validation is one of the corner stones making it harder for players to cheat. If you only care about performance you should not use an authoritative server in the first place.

i didn’t say or even imply that. cheat prevention is a very important aspect, but sometimes you just don’t need validation when it comes to stuff which isn’t potential for cheating.

why would you even need a validation function if you just return true on that one? there is no single benefit from it. only longer development time (copy-pasting that syntax), uglier code and a little performance hit. i don’t have any tests because i have no other way but to comply with the engine as it is, but one doesn’t need tests to compare performance of nothing vs small code

You should look at the Unreal Header Tool to remove the need for validation. Nothing prevents you from removing the requirement. Just don’t expect a revolution in the performance from skipping a simple return true function call though. You would avoid the need for typing in a validate function though.

sadly i would like to avoid that because i like to keep up with fresh new versions of UE and editing each version is just too much work that doesn’t worth the time, because as you have mentioned, it’s not a revolution. but indeed a lot of work.

I would also like a WithoutValidation for server RPC’s.
The validate functions have very limited usefulness. If you return false, it will drop the client from the game. So you actually can’t test for a lot there, or you drop clients just because they have a outdated state. So i mostly just return true and do the checks in the Implementation function and just drop the RPC if the checks fail, so the client stays connected but it’s request is denied.