因此,我尝试创建一个自定义数据资产以在虚幻引擎中使用。我对此非常陌生,我主要关注艺术,所以尽管我对 OOP 有一个大致的了解,但 C++ 远不是我的强项。无论如何,我的课程如下所示:
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 …Run Code Online (Sandbox Code Playgroud)