简体   繁体   中英

Kryonet class not registered even though I register

I'm making a 2d game and want to implement multiplayer , to be easier I'm using an API called Kryonet . Following this tutorial . The version of Kryonet I'm using is, like the tutorial, 1.04.


I saw all the 6 videos and my code looks a bit like him as you can see:

Client :

Server :


It seems to be fine but then I run the server and the client and on client I get :

客户端控制台输出

Server runs without an error.


Thanks in advance.

Just found the problem by looking at the Kryonet Examples , it was that on the register method at Multiplayer class it shouldn't be:

Kryo kryo = new Kryo();

But instead

Kryo kryo = client.getKryo();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM