Skip to content

Commit 2f197a0

Browse files
committed
+ GetModulePlugin()
1 parent 38ce7a6 commit 2f197a0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Source/Mcro/Public/Mcro/Modules.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "CoreMinimal.h"
1414
#include "Modules/ModuleInterface.h"
1515
#include "Modules/ModuleManager.h"
16+
#include "Interfaces/IPluginManager.h"
1617
#include "Mcro/AssertMacros.h"
1718
#include "Mcro/TextMacros.h"
1819
#include "Mcro/TypeName.h"
@@ -103,6 +104,13 @@ namespace Mcro::Modules
103104
return *result;
104105
}
105106

107+
/** @brief Get the owning plugin of a given module */
108+
template <CDerivedFrom<IModuleInterface> M>
109+
TSharedPtr<IPlugin> GetModulePlugin()
110+
{
111+
return IPluginManager::Get().GetModuleOwnerPlugin(*InferModuleName<M>());
112+
}
113+
106114
/** @brief Add this interface to your module class if other things can listen to module startup or shutdown */
107115
class MCRO_API IObservableModule : public IModuleInterface
108116
{

0 commit comments

Comments
 (0)