Edit: just noticed you mention unreal build system Ok the following code works with projects though, I’ll leave it up here just in case someone need the code in the future.
Example project ue 5.4
PluginTestProj.zip (78.0 KB)
Static lib to test if plugin is loaded and enabled:
header file
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "PluginTester.generated.h"
/**
*
*/
UCLASS()
class YOUR_API UPluginTester : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
static bool TestPluginLoaded(FString pluginName);
};
cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "PluginTester.h"
#include "Interfaces/IPluginManager.h"
bool UPluginTester::TestPluginLoaded(FString pluginName) {
TSharedPtr<IPlugin> plug = IPluginManager::Get().FindEnabledPlugin(pluginName);
if (plug != nullptr) {
if (plug.Get() != nullptr) {
return true;
}
}
return false;
}
Needed Modules in build file:
"Projects"
example:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "Projects" });
Tested in shipping version and it worked.