ForEachUObject
ForEachUObject 函数遍历当前存在于 GUObjectArray 中的每一个 UObject。
UE4 变量 GUObjectArray 是一个存放 UObject 的大型分块数组。
此数组的结构历年来有所变化,ForEachUObject 函数的设计确保它在所有引擎版本中的行为一致。
参数
| # | 类型 | 说明 |
|---|---|---|
| 1 | function | 为 GUObjectArray 中每个 UObject 执行的回调 |
回调参数
| # | 类型 | 说明 |
|---|---|---|
| 1 | UObject | 该 UObject |
| 2 | integer | UObject 的块索引 |
| 3 | integer | UObject 的对象索引 |
示例
-- Warning: This will take quite a while to finish executing due to all of the 'print' calls
ForEachUObject(function(Object, ChunkIndex, ObjectIndex)
print(string.format("Chunk: %X | Object: %X | Name: %s\n", ChunkIndex, ObjectIndex, Object:GetFullName()))
end)
原文:docs/lua-api/global-functions/foreachuobject.md · 固定提交 560411f18512 · 来源与 MIT 许可