中EN

UFunctions

  • A UFunction is a C++ function that is recognized by the Unreal Engine reflection system. UFUNCTION([specifier...], [meta(...)]) placed on the line above the declaration in the header.
  • UFunctions can bind to Delegates, act as network callbacks, and implement console commands (Exec).
  • Specifiers:
    • BlueprintCallable: can be executed in a Blueprint graph.
    • BlueprintImplementableEvent: can be implemented in a Blueprint graph.
    • BlueprintNativeEvent: designed to be overridden by a Blueprint, but also has a default native implementation in <Name>_Implementation; autogenerated code calls _Implementation if no Blueprint override is found.
    • BlueprintPure: does not affect the owning object; const functions are exposed as pure by default (use BlueprintPure=false to change). Pure functions do not cache their results ... avoid outputting array properties in Blueprint pure functions.
    • BlueprintAuthorityOnly: only executes from Blueprint on a machine with network authority. BlueprintCosmetic: will not run on dedicated servers.
    • CallInEditor: button in Details panel. CustomThunk: UHT will not produce a thunk; user provides via DECLARE_FUNCTION/DEFINE_FUNCTION. Exec: console.
    • Server / Client: executed on server / owning client; implementation in _Implementation. NetMulticast: executed locally on server and replicated to all clients. Reliable / Unreliable: only with Client or Server. WithValidation: adds _Validate returning bool.
  • Meta: DevelopmentOnly, Latent/LatentInfo, WorldContext, DeprecatedFunction, ExpandEnumAsExecs, BlueprintInternalUseOnly, BlueprintProtected, etc. Metadata only exists in the editor.

引用这一章的笔记

输入关键词开始搜索

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