- Home /
Very simple - Appending a space to GUILayout.Label (C#)
Hello everyone, I have a very simple question today.
GUILayout.Label(string, myStyle);
GUILayout.Label(" ");
This creates a label with a string, followed by a label that is a space. This should work:
GUILayout.Label(string + " ", myStyle);
But it doesn't, even though:
GUILayout.Label(string + "anytext", myStyle);
Does work.
Can someone help me make that middle line work?
Don't use "string" as a variable name.
When you say the middle line doesn't work, what doesn't work about it? What error do you get or what does it do wrong?
"string" is O$$anonymous$$ as a variable name in Unityscript, since that uses "String" for the type. Although it's not a good name regardless. The middle line doesn't work since Unity strips whitespace, much like the text parser on this site does.
Answer by Ereptor · Oct 27, 2014 at 09:43 PM
I just used them as separate lines:
//If there's something in this line, print it.
if(line != null){
GUILayout.Label (line, dialogueStyle);
GUILayout.Label (" ");
}
It works.
Answer by Eric5h5 · Sep 26, 2014 at 10:51 PM
Use " " instead of " ". What do you mean, you can't see any difference? ;) The first one is obviously a non-breaking space, achieved by typing alt-space.
Unfortunately, Alt+Space just opens a window in the top corner of monodevelop for me.
Are you using Windows? If so there's probably some sort of cryptic keyboard code you can enter.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Making a bubble level (not a game but work tool) 1 Answer
GUILayout not working for me C# 1 Answer
How can I make space Movement? C# 3 Answers