Plugin dependent on another plugin

Hi,

We’ve built the core of our project as a plugin because it serves as base for multiple uprojects. Our plugin depends on 2 other plugins, one of which is an engine plugin (WebBrowserWidget) and the other is FMODStudio (we’re using it as C++ dependency). Right now, this means our uproject needs to load our own plugin as well as these two to be able to load up correctly. Our own plugin lists WebBrowserWidget and FMODStudio as public dependencies, but I’m looking for a way to have it tell the uproject these other 2 plugins also need to be loaded.

In other words - how do I setup my plugin in such a way that it forces any uproject using it to load 2 other plugins?

Right now, if the uproject does not load our 2 dependency plugins, it will crash saying it was unable to load our own plugin.

Cheers!

1 Like

Hi BasV,

Sorry for the delayed response to your question. Have you tried adding a “Plugins” section to the .uproject file? Something like this:

"Plugins": [
		{
			"Name": "MyPlugin",
			"Enabled": true
		},
		{
			"Name": "MyOtherPlugin",
			"Enabled": true
		}

This will tell the .uproject file to make sure any listed plugins are present when opening the project in the Editor. If they are not included in the project, a notification will pop up to alert you. Does that meet your needs?

Tim

2 Likes

Hi Tim,

Thanks for the response: This is however not what I’m looking for - I was hoping there’s some way to ‘force’ this behavior to happen without having to tell the uproject it. I would like for the uproject to recognise my plugin has these dependencies and then load it automatically, so the user of my plugin doesn’t need to include multiple plugins just to use one!

Cheers

1 Like

Hi, BasV, did you ever findout how to do this? Thanks.

Sadly, no. Right now I’m trying to minimize dependencies and when we do have one we just have to include it in the project’s plugin list. In a way it makes sense - plugins shouldn’t depend upon one another. Good luck!

1 Like

Well, I understand that. But in your case it isn’t actually dependent on one another. Only your plugin is dependent on the 2 plugins, WebBrowserWidget and FMODStudio, but they are not dependent on your plugin.

Isn’t it the same as the case of the plugins OnlineSubsystem and others extending from it like OnlineSubsystemFacebook, OnlineSubsystemAmazon, OnlineSubsystemSteam, etc.

Those many other plugins depend on OnlineSubsystem plugin but not vice versa. Right? And Epic has done it. Or is there something I don’t see here?

1 Like

Hi! Good news:

Quote from it:

New: Dependencies between plugins

Plugins can now declare dependencies on other plugins that the engine will use to automatically enable and load additional plugins they depend on. Dependencies can be listed in a .uplugin using with the same syntax as .uproject files.

I haven’t tried it yet because our project is currently in 4.16, but it looks good!

1 Like

Wow. That’s great. I also can’t try it because mine is also in 4.16. But it’s good to know

1 Like

FWIW, just tried this out in 4.17. In the .uplugin file of your plugin that will load an additional plugin, add a “Plugins” field on the same level as the other fields:

MyPlugin.uplugin:

"Modules": [
    {
      "Name": "MyPlugin",
      "Type": "Runtime",
      "LoadingPhase": "Default"
    }
  ],
  "Plugins": [                       // <--
    {                                // <--
      "Name": "AdditionalPlugin",    // <--
      "Enabled": true                // <--
    }                                // <--
  ]                                  // <--

Then simply include the additional plugin in the PublicDependencyModuleNames of the plugin’s Build.cs:

MyPlugin.Build.cs:

PublicDependencyModuleNames.AddRange(
	new string[]
	{
		"Core",
		"CoreUObject",
        "Engine",
        "AdditionalPlugin",          // <--
	}
);

And of course make sure the parts of the additional plugin you want to use are properly exported using the ADDITIONALPLUGIN_API notation or you’ll get a LNK2019 unresolved external symbol error.

1 Like

do you mean this?

UCLASS()
class ADDITIONALPLUGIN_API USomeClass

I found ADDITIONALPLUGIN_API in *.generated.h file