How to change Default Graph Node Style?

Hello, everyone.

I am currently developing a plugin to customize an editor. One of the features is to change the style of Blueprint nodes.

I have structured the code with the help of GPT, but it is not applying correctly.

Below is the code I received assistance with.

FMyGraphStyle.cpp

#include "MyGraphStyle.h"
#include "SlateGameResources.h"
#include "Interfaces/IPluginManager.h"

TSharedPtr<FSlateStyleSet> FMyGraphStyle::StyleSet = nullptr;

void FMyGraphStyle::Initialize()
{
    if (!StyleSet.IsValid())
    {
        StyleSet = MakeShareable(new FSlateStyleSet("MyGraphStyle"));

        // Define your styles here
        StyleSet->SetContentRoot(IPluginManager::Get().FindPlugin("MyPlugin")->GetBaseDir() / TEXT("Resources"));

        // Example: Changing the background color of all nodes
        StyleSet->Set("Graph.Node.Body", new FSlateColorBrush(FLinearColor::Green));
        StyleSet->Set("Graph.Node.TitleBackground", new FSlateColorBrush(FLinearColor::Blue));
        // Add other styles as needed

        FSlateStyleRegistry::RegisterSlateStyle(*StyleSet);
    }
}

void FMyGraphStyle::Shutdown()
{
    if (StyleSet.IsValid())
    {
        FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet);
        ensure(StyleSet.IsUnique());
        StyleSet.Reset();
    }
}

TSharedPtr<ISlateStyle> FMyGraphStyle::Get()
{
    return StyleSet;
}

MyPlugin.cpp

#include "MyPlugin.h"
#include "MyGraphStyle.h"
#include "Modules/ModuleManager.h"

class FMyPluginModule : public IModuleInterface
{
public:
    virtual void StartupModule() override
    {
        FMyGraphStyle::Initialize();
    }

    virtual void ShutdownModule() override
    {
        FMyGraphStyle::Shutdown();
    }
};

IMPLEMENT_MODULE(FMyPluginModule, MyPlugin)

What I understood is that after creating the SlateStyle and setting the desired style, it should apply when the plugin is executed, but it doesn’t work that way. :frowning:

Is there something more I should look into? I would appreciate your help.

I found answer.

FAppStyle::SetAppStyleSet(*StyleSet.Get());

Need to change the styleset of the current theme through FAppStyle.