EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.81k stars 415 forks source link

2D array is empty when received. #128

Open midn1 opened 7 years ago

midn1 commented 7 years ago

I have this packet:

public class PacketHereIsAChunk {
    public int x;
    public int[][] blocks = new int[Chunk.SIZE_X][Chunk.SIZE_Y];
}

The 2D array is populated before sending. However when the client receives it. All ints become default values (0).

RobertZenz commented 7 years ago

I have quite the same thing, but for me it works. Odd, what version are you using? Do you have your own serializer for arrays? Do you utilize multi-threading (you fill the chunk in one thread and then send it using another)?

midn1 commented 7 years ago

I have version 2.22 and I fill the array in the same thread as the one I send it in.
And no, I do not have a serializer for arrays. Doesn't Kryonet have that builtin?