Network ID vs Handle
Problem
As described in C++ objects refs in Lua caveat, it is crucial to store .networkId
or .handle
instead of actual object references and later retrieve those objects using ObjectManager.ResolveNetworkId(networkId)
or ObjectManager.ResolveHandle(handle)
.
However, you may wonder what is better and safer to store. There is a difference between these.
Always remember, that .handle
can be reused by the game after reconnect, and .networkId
is a unique network ID assigned to this object by the server.
Solution
Prefer storing .networkId
instead of .handle
for all GameObject
.