AvoidanceSystemToggle
AvoidanceSystemToggle
#Overview
name: AvoidanceSystemToggle
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 AvoidanceSystemToggle is to control the activation state of the avoidance system in Unreal Engine 5. This function is part of the AI navigation and avoidance system, which helps AI-controlled characters navigate through the game world while avoiding obstacles and other characters.
The AvoidanceSystemToggle is primarily used within the UAvoidanceManager class, which is part of the Engine module’s AI navigation system. This class is responsible for managing avoidance behaviors for AI-controlled characters.
The value of this variable is set through the AvoidanceSystemToggle function, which takes a boolean parameter to turn the system on or off. This function directly sets the bSystemActive member variable of the UAvoidanceManager class.
The bSystemActive variable interacts with AvoidanceSystemToggle, as it is the internal state that gets modified when the toggle function is called.
Developers should be aware that this function is part of the debug and development toolset, as evidenced by its inclusion in the FSelfRegisteringExec interface and its usage in the Exec_Dev function. It’s primarily intended for testing and debugging purposes rather than runtime gameplay adjustments.
Best practices when using this variable include:
- Use it primarily during development and debugging phases to test AI navigation behavior with and without the avoidance system active.
- Be cautious about toggling this system off in a production environment, as it may lead to unexpected AI behavior.
- Consider using this in conjunction with other debug tools like AvoidanceDebugForUID and AvoidanceDebugForAll for comprehensive testing of AI navigation.
- When using this toggle, ensure to reset it to the desired state before finalizing the game, as unexpected toggling could impact gameplay.
- Be aware that this toggle affects the entire avoidance system, so use it judiciously in complex AI scenarios where selective avoidance might be necessary.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/AI/Navigation/AvoidanceManager.h:168
Scope (from outer to inner):
file
class class UAvoidanceManager : public UObject, public FSelfRegisteringExec
Source code excerpt:
ENGINE_API void AvoidanceDebugForUID(int32 AvoidanceUID, bool TurnOn);
ENGINE_API void AvoidanceDebugForAll(bool TurnOn);
static ENGINE_API void AvoidanceSystemToggle(bool TurnOn);
/** Exec command handlers */
ENGINE_API void HandleToggleDebugAll( const TCHAR* Cmd, FOutputDevice& Ar );
ENGINE_API void HandleToggleAvoidance( const TCHAR* Cmd, FOutputDevice& Ar );
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AI/Navigation/AvoidanceManager.cpp:627
Scope (from outer to inner):
file
function void UAvoidanceManager::AvoidanceSystemToggle
Source code excerpt:
}
void UAvoidanceManager::AvoidanceSystemToggle(bool TurnOn)
{
bSystemActive = TurnOn;
}
void UAvoidanceManager::HandleToggleDebugAll( const TCHAR* Cmd, FOutputDevice& Ar )
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AI/Navigation/AvoidanceManager.cpp:652
Scope (from outer to inner):
file
function bool UAvoidanceManager::Exec_Dev
Source code excerpt:
HandleToggleDebugAll( Cmd, Ar );
}
else if (FParse::Command(&Cmd, TEXT("AvoidanceSystemToggle")))
{
HandleToggleAvoidance( Cmd, Ar );
return true;
}
#endif