SSGX UE4 Update #1

Using GameplayDebugger I wanted to log the speed of the ship I was currently controlling but that wasn’t possible because of the Debug Actor in the GameplayDebugger being set to None.

AFAIK, by default there’re two ways of setting debug actor; one is to point camera at the actor and enable the debugger. It wasn’t working because GD does not allow to debug actor that is currently controlled by the player (PlayerController).

The other way requires selecting the actor in the hierarchy view. It never worked for me because after possessing the Pawn again the debug actor would be set back to None. Sometimes the debugger wouldn’t even show again on the screen. I tried in PIE and simulate mode.

What I wanted is the debug actor to be set to currently controlled Pawn by default. I didn’t want to set it manually with the replicator.SetDebugActor() or change the camera based selection to select the ship.

From the UGameplayDebuggerLocalController I removed code related to selecting debug actor with camera and instead set the debug actor to currently controlled Pawn every time the GameplayDebugger is activated (with apostrophe key).

void UGameplayDebuggerLocalController::OnActivationPressed()
{
 // set debug actor to currently controlled pawn
 APlayerController* Owner = Replicator->GetReplicationOwner();
 AActor* DebugActor = Owner->GetPawn();
 Replicator->SetDebugActor(DebugActor);
}

The whole class (after modifications) is available on GitHub.

UE4Editor-Win64-Debug_2017-05-30_17-51-03
Custom “Vehicle Movement” category shows ship speed in km/h

As my derived category class I used templated custom category from UE4 wiki A Templatised Gameplay Debugger Category for Actor Components.

How to enable font shadow

In your override of the

void FGameplayDebuggerCategory::DrawData(APlayerController* OwnerPC, FGameplayDebuggerCanvasContext& CanvasContext)

put this line:

 CanvasContext.FontRenderInfo.bEnableShadow = true;

How to disable unused categories

(requires changes to the engine)

By default all registered categories that are supposed to be working in the game mode you’re in (PIE, Simulate or Game) will be enabled and taking screen space even though there’s no data to display.

 

UE4Editor-Win64-Debug_2017-05-30_17-26-49
Categories AI and BehaviorTree enable by default

In order to disable all categories by default, in GameplayDebuggerCategory.FGameplayDebuggerCategory() set bIsEnabled to false and in GameplayDebuggerAddonManager.CreateCategories() remove:

 CategoryObject.bIsEnabled =
 (It.Value.CategoryState == EGameplayDebuggerCategoryState::EnabledInGameAndSimulate) ||
 (It.Value.CategoryState == EGameplayDebuggerCategoryState::EnabledInGame && !bIsSimulate) ||
 (It.Value.CategoryState == EGameplayDebuggerCategoryState::EnabledInSimulate && bIsSimulate);

How to hide unused categories

(requires changes to the engine)

You can hide unused categories entirely like Navmesh or BehaviorTree by setting those categories’ state to Hidden at the point of registration. E.g.

GameplayDebuggerModule.RegisterCategory("BehaviorTree", IGameplayDebugger::FOnGetCategory::CreateStatic(&FGameplayDebuggerCategory_BehaviorTree::MakeInstance), EGameplayDebuggerCategoryState::Hidden, 2);

All engine categories are registered from AIModule.StartupModule().

UE4Editor-Win64-Debug_2017-05-31_09-09-17
Only the category “AG Ship” is visible

How to make GD Actors visible in the outliner and editable

AGameplayDebuggerPlayerManager and `AGameplayDebuggerCategoryReplicator` classes are Actors spawned into the world. By default they’re not visible in the outliner. To enable them, go to the class constructor and set `bEditable` to true.

>> Changes made to Unreal Engine 4.15.2

Leave a comment