目录
[方法 1(推荐):UE 编辑器里创建](#方法 1(推荐):UE 编辑器里创建)
[webclient 类代码:](#webclient 类代码:)
方法 1(推荐):UE 编辑器里创建
-
打开 UE5.6
-
编辑(Edit)→插件(Plugins) -
点击 New Plugin
-
选择:
-
Blank
-
类型:C++
-
-
填写:
-
Name:
DemoPlugin -
勾选:
Enabled By Default
-
-
创建后 重启编辑器
webclient 类代码:
webclient.h
cpp
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Modules/ModuleManager.h"
class FwebclientModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
void HelloWorld();
};
webclient\Private\webclient.cpp
cpp
// Copyright Epic Games, Inc. All Rights Reserved.
#include "webclient.h"
#define LOCTEXT_NAMESPACE "FwebclientModule"
#include "Modules/ModuleManager.h"
#include "Logging/LogMacros.h"
DEFINE_LOG_CATEGORY_STATIC(LogWebClient, Log, All);
UFUNCTION(BlueprintCallable, Category = "WebClient")
static void HelloWorld()
{
UE_LOG(LogTemp, Error, TEXT("Hello World (Play Mode)"));
}
void FwebclientModule::StartupModule()
{
UE_LOG(LogWebClient, Log, TEXT("webclient module started"));
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
HelloWorld();
}
void FwebclientModule::HelloWorld()
{
UE_LOG(LogWebClient, Error, TEXT("Hello World from webclient plugin 111"));
}
void FwebclientModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FwebclientModule, webclient)