我知道虚幻引擎使用反射系统来拥有 C++ 脚本这一事实。我也知道它使用宏来定义引擎应如何反射(reflect)变量。以下是我不知道的:
这些宏是在代码执行中定义元数据(填充列表、定义结构等...),还是它们只是用于生成的解析器的标记更多 C++ 代码,然后引擎使用这些代码来了解要反射(reflect)哪些变量?
它必须是这两者之一,因为我非常怀疑宏是否可以帮助解析调试代码,这是我在调查了几个 C++ 反射系统后发现的唯一第三个选项。
最佳答案
虚幻引擎生成用于反射系统的 C++ 代码。
UHT parses the headers, builds up a set of reflection data, and then generates C++ code containing the reflection data (contributing to a per-module .generated.inl), as well as various helpers and thunk functions (per-header .generated.h).
来自 https://www.unrealengine.com/en-US/blog/unreal-property-system-reflection
关于c++ - Unreal 使用什么样的反射?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58389784/