I have Plugin.cpp
. There are variables in Plugin.cpp
that PluginComponent.cpp
needs. All files reside in the same plugin folder. How do I do that?
Figured it out! First, you need to make a way for PluginComponent.cpp
to get the plugin (or module).
Add this to your Plugin.h
:
static inline FPluginModule& Get()
{
return FModuleManager::LoadModuleChecked< FPluginModule >( "PluginName" );
}
PluginName
should be the same name you chose for your plugin. This is found in your Plugin.uplugin
file under Modules
> Name
.
Then in PluginComponent.cpp
you can access your Plugin.cpp
variables via:
FPluginModule::Get().yourPublicVariable;
Thank you very much for sharing your answer! Helped me a lot!