中EN

Properties (UPROPERTY)

  • Declaration: UPROPERTY([specifier, ...], [meta(key=value, ...)]) Type VariableName;
  • Integers: int8..int64 / uint8..uint64. Bitmask via meta=(Bitmask), UENUM(Meta=(Bitflags)), BitmaskEnum; range 0..31.
  • Strings: FString (dynamic array of chars); FName (reference to immutable case-insensitive string in a global string table; smaller and more efficient to pass around, harder to manipulate); FText (localization).
  • Selected specifiers:
    • BlueprintAssignable: Multicast Delegates only. Exposes the property for assigning in Blueprints.
    • BlueprintReadOnly / BlueprintReadWrite (mutually incompatible).
    • Config: value saved to the class's .ini; implies BlueprintReadOnly.
    • EditAnywhere: editable on archetypes and instances. EditDefaultsOnly: only on archetypes. EditInstanceOnly: only on instances. Incompatible with Visible*.
    • VisibleAnywhere / VisibleDefaultsOnly / VisibleInstanceOnly: visible, not editable.
    • Instanced: Object properties only; each instance gets a unique copy of the Object assigned in defaults.
    • Replicated; ReplicatedUsing=FunctionName (callback when updated over the network).
    • SaveGame: include fields for a checkpoint/save system; a proxy archiver reads/writes it.
    • Transient: not saved or loaded; zero-filled at load time.
  • Metadata only exists in the editor; do not write game logic that accesses metadata. (e.g. ClampMin/ClampMax, EditCondition (full expression parser), ExposeOnSpawn, DisplayName.)

引用这一章的笔记

输入关键词开始搜索

滚轮或双指缩放 · 拖动平移 · 双击放大 / 还原