How would one include a header and class from another plugin that can potentially be there, meaning “do one thing if the user has the other plugin, and another if user has not installed the other plugin”.
Basically, I am making plugin A, and it can use plugin B, but B is optional and just provides extra features, you can use A without B.
Simple example:
in plugin A class:
#include "../../PluginB/Source/PluginB/Public/PluginB.h"
FString FPluginA::GetPluginBProperty(UActorComponent* PluginBActor)
{
UPluginBActor* PluginBActor = static_cast<UPluginBActor*>(PluginBActor);
Fstring PluginBPropertyValue = static_cast<int>(PluginB->someProperty);
return PluginBPropertyValue;
}
I have a check that works if the PluginBModule is loaded, but I cannot use the classes without the include
My problems are the following:
Include file might or might not exist here
I do not want to put PluginB into the PluginA build dependecies because maybe the user doesnt have it - or include it as optional if that is possible?
I cannot use the UPluginBActor without the include
I’m thinking some directives or something similar but cannot get it to work
Does someone have any clues as to what direction I should think of to use it like this?