因此,我正在尝试创建一个自定义数据资产,以便在“虚幻引擎”中使用。我对此非常陌生,我主要关注于艺术,所以这个C++并不接近我的强项,尽管我对OOP有一个大致的理解。无论如何,我的课看起来如下:
USTRUCT()
struct FTrainFormations {
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere)
FString TrainEntry;
UPROPERTY(EditAnywhere)
bool Flipped;
UPROPERTY(EditAnywhere)
bool CargoLoaded;
UPROPERTY(EditAnywhere)
bool AllowSubstitution;
};
UCLASS(BluePrintType)
class TS2NEW_API UTrainFormation : public UDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Train")
TArray<FTrainFormations> Formation;
UPROPERTY(EditAnywhere, Category = "Train", DisplayName = "Train Numbering Overrides")
TArray<int> TrainNumberingOverrides;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Vehicle Substitution")
float BlockTrainProbability;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Rail Vehicle Information")
int CommonnessWeighting;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Rail Vehicle Information")
bool IsSubstitutableUnit;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Rail Vehicle Information")
bool IsDrivable;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Browse Information", DisplayName = "Friendly Name")
FString NameProperty;
};它有效地创建了这样一个数据类:

我的问题是-如何将主数组元素从"4成员“更改为第一个字段的值?因此,当我稍后查看数组时,我可以看到数组内部的内容,而不必展开它。我到处都找遍了,却找不到任何东西,但我可能找错了东西。
发布于 2020-06-26 14:02:56
解决:它实际上是超级容易,只是很难找到答案,因为似乎没有人知道它。
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Train", meta = (TitleProperty = TrainEntry))
TArray<FTrainFormations> Formation;本质上,您必须在数组的UPROPERTY上使用元数据说明符"TitleProperty“,并且可以设置静态标题或将其指向将覆盖"# members”的变量。根据上面的问题,这个示例将其赋值为FString TrainEntry的值。
https://stackoverflow.com/questions/62563676
复制相似问题