Console ShowFlags and Detour Crowd Debugging

Hello Everyone. I’m reposting this from the forum hoping someone will have an answer :slight_smile: .

While working with the detour crowd system I decided to make crowd actors debug drawing toggles accessible via the console to be able to easily enable and disable it in-game without an engine recompile.
To accomplish this I decided to use the ShowFlags console commands like Navigation and DebugAI do (with a ShowFlag.DebugDetourCrowd command).
While reading through the engine code I noticed that the show flags declared via the SHOWFLAG* macros can be set :

  1. Via the show [Flag] command, this is handled by the current view Exec and sets the view’s EngineShowFlags.

    int32 debugShowFlagIndex = FEngineShowFlags::FindIndexByName(TEXT(“DebugDetourCrowd”));
    bool bEnableDebugDraw = GetWorld()->GetGameViewport()->EngineShowFlags.GetSingleFlag(debugShowFlagIndex);

  2. Via the ShowFlags.[Flag] [1/0] command. This does not set the current view’s EngineShowFlags (as I initially thought it would) but only a console variable with the ShowFlag name.

    int32 showFlagDetour = CrowdDebugDrawing::ShowFlagDetourCrowd->GetInt();
    bool bEnableDebugDraw = (showFlagDetour == 1);

In my current implementation I’m checking both and enabling debug if one or both of them are enabled :

int32 debugShowFlagIndex = FEngineShowFlags::FindIndexByName(TEXT("DebugDetourCrowd"));
bool bEnableDebugDraw = GetWorld()->GetGameViewport()->EngineShowFlags.GetSingleFlag(debugShowFlagIndex) || (showFlagDetour == 1);

Is this a good implementation or should I do something different ?
Why are there two different commands with two different code paths to do what seems to be the same thing ? Am I missing something ?
Is using the ShowFlags for crowd debugging a good idea (I’d like to make this a pull request) ?