Skip to content

Customizing Tooltips

Valentin Plyasinov edited this page Aug 12, 2022 · 2 revisions

Plugin supports customizing tooltips for table items.

To customize tooltip generation follow these steps:

  1. Add SubsystemBrowser module dependency in Build.cs

Since Subsystem Browser is an editor module it is recommended to access it only from other editor modules

When using a regular game module dependency has to be guarded with if (Target.bBuildEditor)

PrivateDependencyModuleNames.Add("SubsystemBrowser");
  1. Declare functions for category registration and subsystem selector in your module

Since Subsystem Browser is an editor module it is recommended to access it only from other editor modules

When using a regular game module access to editor-only types and headers has to be guarded with #if WITH_EDITOR

#include "SubsystemBrowserModule.h"

void RegisterSubsystemGlobalCustomizations();

struct FMyEditorModule : public IModuleInterface
{
       virtual void StartupModule() override
       {   // Call it on startup of your editor module
           RegisterSubsystemCategoryCustomizations();
       }
};
  1. Subscribe to delegates
void RegisterSubsystemGlobalCustomizations()
{
	// Customize tooltips for each type of item (Category or Subsystem)
	FSubsystemBrowserModule::OnGenerateTooltip.AddLambda([](TSharedRef<const ISubsystemTreeItem> Item, FSubsystemTableItemTooltipBuilder& Builder)
	{
		if (const FSubsystemTreeSubsystemItem* AsSubsystem = Item->GetAsSubsystemDescriptor())
		{
			UClass* ParentClass = AsSubsystem->Class.IsValid() ? AsSubsystem->Class->GetSuperClass() : nullptr;
			if (ParentClass)
			{
				Builder.AddSecondary(INVTEXT("Parent Class Name"), FText::FromName(ParentClass->GetFName()));
			}
		}
	});

	FSubsystemBrowserModule::OnGetSubsystemOwnerName.BindLambda([](UObject* Instance)
	{
		// Implement your "GetOwner" behavior or use default
		return FSubsystemBrowserUtils::GetDefaultSubsystemOwnerName(Instance);
	});
}
  1. Enjoy working with subsystems
Clone this wiki locally