public static NetworkObject Lookup(long id, ushort typeId, bool snapshot=true)
{
var entity = _manager.GetEntityByUniqueId(id);
if (entity == null) return null;
var type = LookupType(typeId);
var compType = ComponentTypeManager.GetTypeFor(type);
var comp = entity.GetComponent(compType) as NetworkObject;
if (snapshot)
{
List<NetworkObject> objList;
if (_netObjectCache.TryGetValue(entity, out objList))
{
objList.Add(comp);
}
else
{
objList = new List<NetworkObject>();
objList.Add(comp);
_netObjectCache[entity] = objList;
}
_snapshotCache.Add(new Tuple<Entity, NetworkObject>(entity, comp));
}
return comp;
}