SETNOPEC
SETNOPEC
#Overview
name: SETNOPEC
This variable is created as a Console Variable (cvar).
- type:
Exec
- help:
Sorry: Exec commands have no help
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of SETNOPEC is to modify object properties without triggering property change events. It is a variant of the SET command used in Unreal Engine’s console system.
This setting variable is primarily used in the core engine systems, specifically in the UObject and command execution subsystems. Based on the callsites, it’s referenced in the UnrealEd, CoreUObject, and Engine modules.
The value of this variable is not set directly; instead, it’s used as a command identifier in the engine’s command parsing system. When the engine encounters the “SETNOPEC” command, it triggers specific behavior related to property setting.
SETNOPEC interacts with the general SET command and the PerformSetCommand function. While SET triggers property change events, SETNOPEC allows property modification without these events.
Developers must be aware that:
- SETNOPEC is disallowed in the editor to prevent unintended modifications to default objects, which could affect object serialization.
- In shipping builds, both SET and SETNOPEC are restricted in network games to maintain consistency across clients.
Best practices when using this variable include:
- Use SETNOPEC only when you specifically need to modify properties without triggering change events.
- Be cautious when using SETNOPEC in multiplayer scenarios, as it could lead to inconsistencies if not properly synchronized.
- Avoid using SETNOPEC in the editor environment, as it’s explicitly disallowed to prevent serialization issues.
- When developing for shipping builds, be aware of the restrictions on SET and SETNOPEC in networked environments.
- Always consider the potential side effects of modifying properties without triggering change events, especially in complex systems where other components might rely on these events.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:634
Scope (from outer to inner):
file
function bool UUnrealEdEngine::Exec
Source code excerpt:
const TCHAR* Str = Stream;
// disallow set commands in the editor as that modifies the default object, affecting object serialization
if (FParse::Command(&Str, TEXT("SET")) || FParse::Command(&Str, TEXT("SETNOPEC")))
{
Ar.Logf(TEXT("Set commands not allowed in the editor"));
return true;
}
//for thumbnail reclamation post save
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/Obj.cpp:4476
Scope (from outer to inner):
file
function bool StaticExec
Source code excerpt:
return true;
}
else if( FParse::Command(&Str,TEXT("SETNOPEC")) )
{
PerformSetCommand( Str, Ar, false );
return true;
}
#if !UE_BUILD_SHIPPING
else if( FParse::Command(&Str,TEXT("LISTFUNCS")) )
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:1527
Scope (from outer to inner):
file
function bool UGameEngine::Exec
Source code excerpt:
#if UE_BUILD_SHIPPING
// disallow set of actor properties if network game
if ((FParse::Command( &Cmd, TEXT("SET")) || FParse::Command( &Cmd, TEXT("SETNOPEC"))))
{
FWorldContext &Context = GetWorldContextFromWorldChecked(InWorld);
if( Context.PendingNetGame != NULL || InWorld->GetNetMode() != NM_Standalone)
{
return true;
}