As you can see, the first message over there is clipped on the chatbox of the server.
It can’t be that the data was lost while being transmitted, because the messages don’t appear on the client until the server approves them and hands them back.
If data was lost, the client wouldn’t have it as well.
I assumed it is an issue with CalcHeight, but it’s weird: the word was clipped as if about to be sent to the line below.
Here is the code I’m using for displaying messages in the ChatBox:
switch (message.msgType){
case MsgType.PlayerMessage:
text = "<color=#FF0000>" + DataManager.playerDataTable.Get(message.player).Get("chatName") + "</color><b>:</b> " + message.text;
message.lastKnownPlayerName = DataManager.playerDataTable.Get(message.player).Get("chatName").ToString();
break;
case MsgType.ServerMessage:
text = "<color=#00FF00>" + DataManager.serverData.Get("chatName") + "</color><b>:</b> " + message.text;
break;
case MsgType.SimpleMessage:
text = "<b><color=#FFFF00>" + message.text + "</color></b>";
break;
}
height = (int)style.CalcHeight(new GUIContent(text), chatBoxRect.width - (messageSpacer * 2)); // The markup tags are handed in too. My logic is that bold parts will be calculated with their actual width like this?
GUI.Label (new Rect(messageSpacer, y, chatBoxRect.width - (messageSpacer * 2) - 10, height), text);
y += height; // This is to arrange the messages in the chatbox.