Isn't this a bug that it is checked in non-editor builds?

So we got a (pretty rare) crash on our dedicated servers where it would incorrectly execute a client RPC call.

I’ve traced the issue down to the following code. GAllowActorScriptExecutionInEditor is true in this case. But… why are we even checking a bool that is supposed to gate logic in the editor?

Shouldn’t this check be wrapped behind a #if WITH_EDITOR pragma? Or…is it a poorly worded global variable???

//
// Return whether a function should be executed remotely.
//
int32 AActor::GetFunctionCallspace( UFunction* Function, FFrame* Stack )
{
	if (GAllowActorScriptExecutionInEditor)
	{
		// Call local, this global is only true when we know it's being called on an editor-placed object
		DEBUG_CALLSPACE(TEXT("GetFunctionCallspace ScriptExecutionInEditor: %s"), *Function->GetName());
		return FunctionCallspace::Local;
	}

[Attachment Removed]

Hello Scott, I apologize for not responding until now:

Yes that variable was originally added for editor use cases, but it is also used for automated tests that sometimes need to run in cooked builds so it cannot use WITH_EDITOR. It is not named well and some of the logic around it is a bit weird, but it should not be true in normal gameplay situations. If you have any follow up questions about your specific case, please leave a comment (we’re about to go on break for 2 weeks so I may not reply immediately).

[Attachment Removed]