我正在尝试创建一个自定义类,然后我可以在我的蓝图中使用它。我需要这个类来保存玩家信息,比如名字和他们图片的路径。到目前为止我所做的没有编译或构建没有错误,我不知道如何修复它,因为我从未使用过这个
header file #pragma once
#include "Object.h"
#include <iostream>
#include "PlayerClass.generated.h"
/**
*
*/
UCLASS()
class PROTOTYPE2_API UPlayerClass : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Switch Variables");
string playerName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Switch Variables")
string playerTeam;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Switch Variables")
string picPath;
UPlayerClass(const FObjectInitializer& ObjectInitializer);
UFUNCTION()
void importPic(string picPath);
};
.cpp 文件
#include "Prototype2.h"
#include "PlayerClass.h"
UPlayerClass::UPlayerClass(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
playerName = "";
playerTeam = "";
picPath = "";
}
void UPlayerClass::importPic_Implementation(Fstring picPath)
{
}