i've got issue here that's baffling me. i'm building little multiplayer chatbox functionality in unity. post message using following function:
public void addline(string text) { getcomponent<text>().text += "\n" + text; }
the problem here code works until connect chat server, , string refuses concatenate further. have verified debugger "text" parameter passing information function. far can tell fine, , yet isn't.
as aside, i'm encoding text data byte array, shooting server, , have decode string when gets client. in debugger data returned server looks correct, , yet program breaks once receives data.
is there byte encoding process might mess string up? program treating string if doesn't exist, , yet in debugger, looks good.
ok able answer own question. turns out when decode string byte array, string retains length of byte array. string has bunch of nulls @ end of debugger won't report.
concatenating string fails under scenario.