我是 C++ 新手,正在尝试从 Unity3D 迁移到虚幻引擎 4。现在我正在尝试编写我的第一个插件(UI 插件和工具是我工作中非常重要的一部分),并坚持将 OnClicked 事件添加到 SButton I从创建独立窗口插件开始并添加一个按钮。
TSharedRef<SDockTab> FAssistLibModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs) {
FText WidgetText = FText::Format(
LOCTEXT("WindowWidgetText", "Add code 111 222 to {0} in {1} to override this window's contents"),
FText::FromString(TEXT("FAssistLibModule::OnSpawnPluginTab")),
FText::FromString(TEXT("AssistLib.cpp"))
);
FText ButtonLabel = FText::FromString("Button?");
return SNew(SDockTab)
.TabRole(ETabRole::NomadTab)
[
// Put your tab content here!
SNew(SVerticalBox)
+SVerticalBox::Slot().VAlign(VAlign_Top)
[
SNew(STextBlock)
.Text(WidgetText)
]
+SVerticalBox::Slot().VAlign(VAlign_Top)
[
SNew(SButton)
.Text(ButtonLabel)
.OnClicked(this, &FAssistLibModule::CollectBlueprintsButtonClicked)
]
];}
Run Code Online (Sandbox Code Playgroud)
编译 UE 后给我这个错误
Info Compiling game modules for hot reload
Info Performing 2 actions (4 …Run Code Online (Sandbox Code Playgroud)