中EN

Coding in UE: Blueprint vs. C++

Markdown2 KB 原始文件

(实际抓取 URL: https://dev.epicgames.com/documentation/unreal-engine/coding-in-unreal-engine-blueprint-vs-cplusplus?lang=en-US)

  • Most projects benefit from using a mix of the two.
  • Programming: instructions that define systems. Scripting: instructions that define behaviors by interfacing with existing systems. (e.g. vehicle system in programming; car/boat types in scripting.) C++ is a programming language, Blueprint is a scripting language, but the line is blurred.
  • Blueprint strengths: scripting; faster iteration; broader accessibility; greater discoverability; safer memory model designed to avoid crashes.
  • C++ strengths: programming new systems; faster runtime performance; access to lower-level functionality; extensibility with external libraries; greater control; smoother collaboration (text, diff/merge; Unreal Diff Tool exists for Blueprints); better scalability; better debugging.
  • Performance: C++ compiles into machine code; Blueprints compile into bytecode that executes on a virtual machine. Differences are usually insignificant and depend on context. Most impact: core low-level infrastructure; tight loops heavy on I/O or processing; large data sets; tick-dependent classes with many instances; scenarios that benefit from multi-threading, as Blueprint does not support it.
  • Use timers or delegates to schedule work in Blueprints instead of using Tick. Profile with Unreal Insights before converting Blueprint to C++.
  • Best approach: C++ as the foundation and build Blueprint classes on top of it. Expose C++ to Blueprint: Blueprint subclass + UPROPERTY(BlueprintReadWrite) / UFUNCTION(BlueprintCallable); UBlueprintFunctionLibrary static functions.
  • Expose Blueprint to C++: BlueprintImplementableEvent (pure virtual you must implement in Blueprint); BlueprintNativeEvent (virtual optionally overridden in Blueprint); UPROPERTY(meta=(BindWidget)) for UserWidget.
  • Converting: Blueprint Header View generates a .h with declarations; implementation must be converted manually; Core Redirects remap references.

引用这一章的笔记

输入关键词开始搜索

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