public void write(BytesWriteStream stream) { stream.writeVector3(origin); stream.writeVector3(unit); stream.writeInt(resolutionX); stream.writeInt(resolutionZ); int len = heightSamples.Length; stream.writeLen(len); for (int i = 0; i < len; i++) { stream.natureWriteShort(heightSamples[i]); } }