Unreal Engine 4 Blank Module

I am trying to enter the modular modular version of the 4th module, starting with an empty module for starters, but click on the block from the beginning.

The tutorial I went through for the non-game module: https://wiki.unrealengine.com/An_Int...to_UE4_Plugins . I tried to go exactly according to the source and then modified everything to TestPlugin (since I couldn't get it to work with the tutorial).

For some reason, when I try to activate a module in the editor, I get "cannot find the module" Module ". I am trying to figure out if I missed something, here is the code I have so far:

../Motor/Plugin/TestPlugin/TestPlugin.uplugin

{
    "FileVersion" : 3,

    "FriendlyName" : "Test Plugin",
    "Version" : 1,
    "VersionName": "1.0",
    "EngineVersion" : 1579795,
    "Description" : "Description goes here",
    "Category" : "Test.Module",
    "CreatedBy" : "arhon",
    "CreatedByURL" : "http://stackoverflowcom",
    "CanContainContent" : "true",

    "Modules" :
    [
        {
            "Name" : "Module",
            "Type" : "Developer",
            "LoadingPhase" : "PreDefault"
        } 
    ]
}

      

../Motor/Plugin/TestPlugin/Source/TestPlugin/TestPlugin.cpp

 void FTestPlugin::StartupTestPlugin()
    {
        if (ITestPlugin::IsAvailable())
        {
            UE_LOG(TestPlugin, Log, TEXT("%s"), ITestPlugin::Get().IsThisNumber42(42) ? TEXT("True") : TEXT("False"));
            UE_LOG(TestPlugin, Log, TEXT("%s"), ITestPlugin::Get().IsThisNumber42(12) ? TEXT("True") : TEXT("False"));
        }
    }

      

../Motor/Plugin/TestPlugin/Source/TestPlugin/TestPlugin.Build.cs

using UnrealBuildTool;

public class TestPlugin : ModuleRules
{
    public TestPlugin(TargetInfo Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        PrivateDependencyModuleNames.AddRange(new string[] { "TestPlugin" });

        DynamicallyLoadedModuleNames.AddRange(new string[] { "StandAlone" });
    }
}

      

../Motor/Plugin/TestPlugin/Source/TestPlugin/Public/ITestPlugin.h

#pragma once

#include "ModuleManager.h"
/**
* The public interface to this module.  In most cases, this interface is only public to sibling modules
* within this plugin.
*/
class ITestPlugin : public ITestPluginInterface
{

public:

    /**
    * Singleton-like access to this module interface.  This is just for convenience!
    * Beware of calling this during the shutdown phase, though.  Your module might have been unloaded already.
    *
    * @return Returns singleton instance, loading the module on demand if needed
    */
    static inline ITestPlugin& Get()
    {
        return FModuleManager::LoadModuleChecked< ITestPlugin >("TestPlugin");
    }

    /**
    * Checks to see if this module is loaded and ready.  It is only valid to call Get() if IsAvailable() returns true.
    *
    * @return True if the module is loaded and ready to use
    */
    static inline bool IsAvailable()
    {
        return FModuleManager::Get().IsModuleLoaded("TestPlugin");
    }

    virtual bool IsThisNumber42(int32 num) = 0;
};

      

../Motor/Plugin/TestPlugin/Source/TestPlugin/Private/TestPluginPrivatePCH.h

#include "ITestPlugin.h"

// You should place include statements to your module private header files here.  You only need to
// add includes for headers that are used in most of your module source files though.

      

../Motor/Plugin/TestPlugin/Source/TestPlugin/Private/TestPlugin.h

#pragma once

class TestPluginImpl : public ITestPlugin
{
public:
    /** IModuleInterface implementation */
    void StartupTestPlugin();
    void ShutdownTestPlugin();

    bool IsThisNumber42(int32 num);
};

      

../Motor/Plugin/TestPlugin/Source/TestPlugin/Private/TestPlugin.cpp

#include "TestPluginPrivatePCH.h"

#include "TestPlugin.h"

void TestPluginImpl::StartupTestPlugin()
{
}

void TestPluginImpl::ShutdownTestPlugin()
{
}

bool TestPluginImpl::IsThisNumber42(int32 num)
{
    return num == 42;
}

IMPLEMENT_MODULE(TestPluginImpl, TestPlugin)

      

+3


source to share


1 answer


In the .uplugin file, look at the name of your module, then in the testplugin.cpp file, look at this line:

IMPLEMENT_MODULE(TestPluginImpl, TestPlugin)

      

I'm sure they should match.

eg:.



"Modules" :
    [
        {
            "Name" : "NebulaAudioAnalysisPlugin",
            "Type" : "Runtime"
        } 
    ]

      

and my implementation looks like this:

IMPLEMENT_MODULE(FNebulaAudioAnalysisPlugin, NebulaAudioAnalysisPlugin) 

      

I found it all the hard way ...

+3


source







All Articles