如何解决"C2660 'SWidget::Construct': function does not take 1 arguments"?
How to resolve "C2660 'SWidget::Construct': function does not take 1 arguments"?
我该如何解决
C2660 'SWidget::Construct': function does not take 1 arguments
我正在尝试放置一个显示游戏控件的小部件。
我是 Unreal Engine.
的新手
错误
C2660 'SWidget::Construct': function does not take 1 arguments
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\SlateCore\Public\Widgets\DeclarativeSyntaxSupport.h 862
SPanelWidget.h
#pragma once
#include "SlateBasics.h"
#include "SlateExtras.h"
class SPanelWidget : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SPanelWidget) {}
SLATE_ARGUMENT(TWeakObjectPtr<class AControlPanel>, OwningPanel)
SLATE_END_ARGS()
void construct(const FArguments& InArgs);
TWeakObjectPtr<class AControlPanel> OwningPanel;
virtual bool SupportsKeyboardFocus() const override {return true;};
};
SPanelWidget.cpp
#include "SPanelWidget.h"
#define LOCTEXT_NAMESPACE "Panel"
void SPanelWidget::construct(const FArguments& InArgs) {
const FText TitleText = LOCTEXT("ProjectTitle","Chair Table Practice Problem");
const FMargin ContentPadding = FMargin(500.f,300.f);
ChildSlot [
SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) [
SNew(SImage)
.ColorAndOpacity(FColor::Black)
]
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.Padding(ContentPadding) [
SNew(SVerticalBox)
+SVerticalBox::Slot() [
SNew(STextBlock)
.Text(TitleText)
]
]
];
}
#undef LOCTEXT_NAMESPACE
需要用大写字母声明Construct函数'C'.
图片来源:splodginald
我该如何解决
C2660 'SWidget::Construct': function does not take 1 arguments
我正在尝试放置一个显示游戏控件的小部件。
我是 Unreal Engine.
错误
C2660 'SWidget::Construct': function does not take 1 arguments
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\SlateCore\Public\Widgets\DeclarativeSyntaxSupport.h 862
SPanelWidget.h
#pragma once
#include "SlateBasics.h"
#include "SlateExtras.h"
class SPanelWidget : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SPanelWidget) {}
SLATE_ARGUMENT(TWeakObjectPtr<class AControlPanel>, OwningPanel)
SLATE_END_ARGS()
void construct(const FArguments& InArgs);
TWeakObjectPtr<class AControlPanel> OwningPanel;
virtual bool SupportsKeyboardFocus() const override {return true;};
};
SPanelWidget.cpp
#include "SPanelWidget.h"
#define LOCTEXT_NAMESPACE "Panel"
void SPanelWidget::construct(const FArguments& InArgs) {
const FText TitleText = LOCTEXT("ProjectTitle","Chair Table Practice Problem");
const FMargin ContentPadding = FMargin(500.f,300.f);
ChildSlot [
SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill) [
SNew(SImage)
.ColorAndOpacity(FColor::Black)
]
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
.Padding(ContentPadding) [
SNew(SVerticalBox)
+SVerticalBox::Slot() [
SNew(STextBlock)
.Text(TitleText)
]
]
];
}
#undef LOCTEXT_NAMESPACE
需要用大写字母声明Construct函数'C'.
图片来源:splodginald