unreal engine 5.2 基本数据类型

image

基本数据类型

蓝图 C++ sizeof 描述
Boolean bool 1 true / false
Byte uint8 1 0 / 255
Integer int32 4 −2,147,483,648 / 2,147,483,647
Integer64 int64 8 −9,223,372,036,854,775,808 / 9,223,372,036,854,775,807
Float double 8
Name FName 12 不区分大小写。它们为不可变,无法被操作。
String FString 16 可变字符串
Text FText 24 文本本地化的主要组件
Vector FVector 24
Vector2D FVector2D 16
Rotator FRotator 24
Transform FTransform 96
UObject UObject 48
UFunction UFunction 264
AActor AActor 1024

通过C++ Header Preview工具查看实际映射

/** Please add a class description */
UCLASS(Blueprintable, BlueprintType)
class ABp_HelloGameState : public AHelloGameStateBase
{
    GENERATED_BODY()
public:
    /** Please add a variable description */
    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category="Default")
    TObjectPtr<USceneComponent> DefaultSceneRoot;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    bool NewVar;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    uint8 NewVar_0;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    int32 NewVar_1;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    int64 NewVar_2;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    double NewVar_3;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    FName NewVar_4;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    FString NewVar_5;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    FText NewVar_6;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    FVector NewVar_7;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    FRotator NewVar_8;

    /** Please add a variable description */
    UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
    FTransform NewVar_9;
};

参考

https://docs.unrealengine.com/5.2/zh-CN/blueprint-variables-in-unreal-engine/
https://docs.unrealengine.com/5.2/zh-CN/string-handling-in-unreal-engine/
https://docs.unrealengine.com/5.0/zh-CN/epic-cplusplus-coding-standard-for-unreal-engine/
https://www.tomlooman.com/unreal-engine-cpp-guide/
https://en.cppreference.com/w/cpp/language/types
https://zhuanlan.zhihu.com/p/163587790

posted @ 2023-06-24 16:18  BuzzWeek  阅读(61)  评论(0编辑  收藏  举报