Get a define in code if plugin is loaded and build into project.

This put me on the right path but JsonObject is in EpicGames.Core not UnrealBuildTool.

This is how my plugin successfully checks if they have GameplayAbilities plugin enabled, tested and working.

  1. Build.cs
  2. .uplugin (enabled=false, optional=true)
  3. Actual usage

Tested it (only on windows):

  • In editor
  • Packaged in development and confirmed with logging
  • Packaged in shipping but I don’t have logging to test for certain
  • With the plugin both enabled and disabled in all above cases

I do not know if it works when you enable/disable the GameplayAbilities plugin in some unrelated .uplugin instead of your .uproject

Rider correctly detects this also. But when enabling/disabling the plugin to get it to update you have to restart Rider. If you right click your plugin module and “Reload Project” it detects the state of the pre-processor macro but thinks you’re missing includes.

Honestly, I don’t like it. Unreal needs to provide “official” tools to deal with this.