ForEachUObject

The ForEachUObject function iterates every UObject that currently exists in GUObjectArray.

The GUObjectArray UE4 variable is a large chunked array that contains UObjects.

The structure of this array has changed over the years and the ForEachUObject function is designed to work identically across all engine versions.

Parameters

#TypeInformation
1functionCallback to execute for every UObject in GUObjectArray

Callback Parameters

#TypeInformation
1UObjectThe UObject
2integerThe chunk index of the UObject
3integerThe object index of the UObject

Example

-- 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)