簡體   English   中英

虛幻引擎4空白模塊

[英]Unreal Engine 4 Blank Module

我正在嘗試進入虛幻引擎4模塊開發,從啟動器的空白模塊開始,但在開始時遇到一個塊。

我參加了非游戲模塊的教程: https//wiki.unrealengine.com/An_Int...to_UE4_Plugins 我嘗試完全通過源代碼,然后將所有內容修改為TestPlugin(因為我無法通過教程使其工作)。

出於某種原因,每當我嘗試在編輯器中激活模塊時,我都會得到“找不到”模塊“模塊”。 我想知道我是否錯過了什么,這是我到目前為止的代碼:

../Engine/Plugins/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"
        } 
    ]
}

../Engine/Plugins/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"));
        }
    }

../Engine/Plugins/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" });
    }
}

../Engine/Plugins/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's 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;
};

../Engine/Plugins/TestPlugin/Source/TestPlugin/Private/TestPluginPrivatePCH.h

#include "ITestPlugin.h"

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

../Engine/Plugins/TestPlugin/Source/TestPlugin/Private/TestPlugin.h

#pragma once

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

    bool IsThisNumber42(int32 num);
};

../Engine/Plugins/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)

.uplugin文件中,查看您的模塊名稱,然后在testplugin.cpp中 ,查看以下行:

IMPLEMENT_MODULE(TestPluginImpl, TestPlugin)

我確定他們需要匹配。

例如:

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

我的實現看起來像:

IMPLEMENT_MODULE(FNebulaAudioAnalysisPlugin, NebulaAudioAnalysisPlugin) 

我發現這一切都很困難......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM