Disabling a plugin for being compiled on platform

I have a plugin that I’ve created that can only be compiled on Linux, which I want to run on the server. I’ve got this in the main .uproject file:



    "Plugins": 
        {
            "Name": "LinuxServer",
            "Enabled":  true,
            "WhitelistPlatforms": 
                "Linux"
            ]
        }
    ]


I also have this in the main game build.cs file



        if(Target.Type == TargetType.Server && Target.IsInPlatformGroup(UnrealPlatformGroup.Unix))
        {
            PublicDependencyModuleNames.AddRange(new string] { "LinuxServer" });
        }


I also have this in the plugin .uplugin file


    "Modules": 
        {
            "Name": "LinuxServer",
            "Type": "Runtime",
            "LoadingPhase": "PreDefault",
            "WhitelistPlatforms": 
                "Linux"
            ]


However, when compiling for Windows, I still get compile errors coming from that plugin. Is there a way to truely disable a plugin from being compiled on Windows? What am I missing here?

1 Like

In the the main .uproject file replace “WhitelistPlatforms” with “SupportedTargetPlatforms”:

	"Plugins": [
		{
			"Name": "PluginName",
			"Enabled": true,
			"SupportedTargetPlatforms": [
				"Linux"
			]
		}
	]

and in the plugin .uplugin file add “SupportedTargetPlatforms” to the plugin descriptor.

{
	"FileVersion": 3,
	"Version": 1,
	"VersionName": "1.22",
	"FriendlyName": "PluginName",
	// The "SupportedTargetPlatforms" value is in the plugin descriptor
	"SupportedTargetPlatforms": [
		"Linux"
	],
	"Modules": [
		{
			"Name": "PluginName",
			"Type": "Runtime",
			"LoadingPhase": "PreDefault"
		}
	]
}

I hope this is helpful, I am on UE 4.27