Add option to directly serialize object instead of leaving it up to networking code.