UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GameplayDebugger.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3// GAMEPLAY DEBUGGER
4//
5// This tool allows easy on screen debugging of gameplay data, supporting client-server replication.
6// Data is organized into named categories, which can be toggled during debugging.
7//
8// To enable it, press Apostrophe key (UGameplayDebuggerConfig::ActivationKey)
9//
10// Category class:
11// - derives from FGameplayDebuggerCategory
12// - implements at least CollectData() and DrawData() functions
13// - If WITH_GAMEPLAY_DEBUGGER is defined (doesn't exist in shipping builds by default; see note below to override), it will include all default debug categories and menu
14// - If WITH_GAMEPLAY_DEBUGGER_CORE is defined (see note below), it will compile the core parts of the tool, waiting for user to register a debug category and create a replicator when desired.
15// - needs to be registered and unregistered manually by owning module
16// - automatically replicate data added with FGameplayDebuggerCategory::AddTextLine, FGameplayDebuggerCategory::AddShape
17// - automatically replicate data structs initialized with FGameplayDebuggerCategory::SetDataPackReplication
18// - can define own input bindings (e.g. subcategories, etc)
19//
20// Extension class:
21// - derives from FGameplayDebuggerExtension
22// - needs to be registered and unregistered manually by owning module
23// - can define own input bindings
24// - basically it's a stateless, not replicated, not drawn category, ideal for making e.g. different actor selection mechanic
25//
26//
27// Check FGameplayDebuggerCategory_BehaviorTree for implementation example.
28// Check AIModule/Private/AIModule.cpp for registration example.
29//
30// Note. Use 'SetupGameplayDebuggerSupport(Target)' when adding module to your project's Build.cs (see AIModule/AIModule.Build.cs)
31// Note. Use 'bUseGameplayDebugger={0|1}' in your <ProjectTargetType>.Target.cs to force GameplayDebugger disabled/enabled (if enabled, it will implicitly set bUseGameplayDebuggerCore=1)
32// Note. Use 'bUseGameplayDebuggerCore={0|1}' in your <ProjectTargetType>.Target.cs to compile on/off the GameplayDebugger core parts only
33//
34
35#pragma once
36
37#include "CoreMinimal.h"
40
49
51{
52
53public:
56
63 static inline IGameplayDebugger& Get()
64 {
65 return FModuleManager::LoadModuleChecked< IGameplayDebugger >("GameplayDebugger");
66 }
67
73 static inline bool IsAvailable()
74 {
75 return FModuleManager::Get().IsModuleLoaded("GameplayDebugger");
76 }
77
78 virtual void RegisterCategory(FName CategoryName, FOnGetCategory MakeInstanceDelegate, EGameplayDebuggerCategoryState CategoryState = EGameplayDebuggerCategoryState::Disabled, int32 SlotIdx = INDEX_NONE) = 0;
79 virtual void UnregisterCategory(FName CategoryName) = 0;
80 virtual void NotifyCategoriesChanged() = 0;
81 virtual void RegisterExtension(FName ExtensionName, FOnGetExtension MakeInstanceDelegate) = 0;
82 virtual void UnregisterExtension(FName ExtensionName) = 0;
83 virtual void NotifyExtensionsChanged() = 0;
84};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EGameplayDebuggerCategoryState
Definition GameplayDebugger.h:42
uint8_t uint8
Definition binka_ue_file_header.h:8
CORE_API bool IsModuleLoaded(const FName InModuleName) const
Definition ModuleManager.cpp:347
static CORE_API FModuleManager & Get()
Definition ModuleManager.cpp:199
Definition NameTypes.h:617
Definition GameplayDebugger.h:51
virtual void RegisterExtension(FName ExtensionName, FOnGetExtension MakeInstanceDelegate)=0
DECLARE_DELEGATE_RetVal(TSharedRef< class FGameplayDebuggerCategory >, FOnGetCategory)
virtual void UnregisterExtension(FName ExtensionName)=0
static bool IsAvailable()
Definition GameplayDebugger.h:73
virtual void NotifyExtensionsChanged()=0
static IGameplayDebugger & Get()
Definition GameplayDebugger.h:63
DECLARE_DELEGATE_RetVal(TSharedRef< class FGameplayDebuggerExtension >, FOnGetExtension)
virtual void UnregisterCategory(FName CategoryName)=0
virtual void RegisterCategory(FName CategoryName, FOnGetCategory MakeInstanceDelegate, EGameplayDebuggerCategoryState CategoryState=EGameplayDebuggerCategoryState::Disabled, int32 SlotIdx=INDEX_NONE)=0
virtual void NotifyCategoriesChanged()=0
Definition ModuleInterface.h:14
Definition SharedPointer.h:153