ok I have a long string and need to create a button out of it.
here is my code so far
var test = "I am a person";
function OnGUI () {
var temp;
temp = test.Split(' ');
if (GUILayout.Button(temp[0]))
{}
}
I get an error saying Split() is not compatible with string or if I use ’ ’ un-expected char
Use string.Split(" "[0])
One of Unity JS’s little annoyances.
wait test.Split(“\n”[0]); doesn’t work for me
I am taking a I got from a php script which is display.php then trying to make it so that when it finds a \n it separates it.
temp = test.Split("\n"[0]);
Hey, are you trying to get the server side high scores thing going on?
I am doing the exact same thing (if that is what you are doing) and I am having the same problem, did you ever get this resolved? (ie the Split(“\n”[0]) problem)
Cheers!
-Ben
oops, I’m dumb, it is working fine now, dont know what I did, but i just went in and retyped… now it works… hehe…
anyway this is my code: (javascript if it isn’t obvious)
var raw : String = hs_get.data;
var lines = raw.Split("\n"[0]);
print("wow:" + lines[0]);
print("neat:" + lines[1]);
print("testing:" + lines[2]);