After adding nested message i recieve nested messages from main message and got nothing.
You can see it in logs: 1 and 2. Size of List 0 !
Any ideas?
message PacketPlayers
{
repeated PacketPlayer players = 1;
}
After adding nested message i recieve nested messages from main message and got nothing.
You can see it in logs: 1 and 2. Size of List 0 !
Any ideas?
message PacketPlayers
{
repeated PacketPlayer players = 1;
}
ScalaPB case classes are immutable. In your example, addPlayers
would not modify the instance it's called on, but return a new instance of PacketPlayer
that has the additional players.
It is possible to avoid mutable arrays and vars in constructing the new object. For example:
val players = onlinePlayers.keySet.map(makePacketPlayer)
val packetPlayers = PacketPlayers().withPlayers(players)