How to display "-" with a gui.label

How can I display -, and some other symbols with the GUI.label?

Is there some special character i need to place before it to make it show?

I just converting the text to unicode and still doesn’t show.

You can catenate strings. As an example:

Debug.Log(playerName + ": " + playerScore);

If playerName = JRavey and playerScore = 77, your output would be:

If I go GUI.Label (Rect (10, 290, 235,170), “Andesite - blah blah”);

The - doesn’t show (and on a mac shows special characters.

Ah, some characters will do that, you can prefix them with \ to stop that, which is also used for other things like carriage returns. Another option is to put an @ in front of the string. You can read about it @ Built-in reference types - C# reference | Microsoft Learn

Works fine for me.

Neither of those work for me. The \ was the first thing I tried before posting this :slight_smile:

I am using unityscript if that makeas any difference?

I double checked it isn’t working at all for me in any place.

I think we’re at the point where you’re going to have to actually show some code, what are you running and what output are you expecting?

@TheRaider
I just did a print test and this seems to work for me.

print ("\"-\"");

Continuing with that test, I wrote another test utilizing that line of code into a GUI.Label

function OnGUI()
{
	GUI.Label(Rect(10,40,100,100), "\"-\"");
}

-S

Are you using unityscript or c#?

literally this code GUI.Label (Rect (10, 290, 235,170), “Andesite - blah blah”);

It is just an interface call. It happens all the time. The solution you gave which probably works for C# and I need the unityscript version.

Expected output would be

Andesite - blah blah

Actual output ( on PC)

Andesite blah blah

On a mac the - is replaced by a wierd looking question mark like symbol

JS. Works. Win7 64,

function OnGUI () {
 GUI.Label (Rect (10, 290, 235,170), "Andesite - blah blah");
}

Report as bug?

May be you are using some custom font where no ‘minus’ glyph?
‘Minus’ is an usual ASCII character and there is no escape character needed.

I am using the ariel font that comes with unity. I am pretty sure it happens when I use the default too cause I was sure i tested that. Now you make me want to check again. I will try it in another project and see what happens.

This really does depend on the font you’re using. Certain fonts like Grotesk have pretty much any symbol you can think of, but I’ve found it to be pretty common that fonts leave out common symbols.

To double check that, get an alternative font file you know has a dash and try that one.

+1
I have had this same problem in past and simply changed the font and it worked fine.

My guess would be that your text editor changes the - to – (i.e. a long -) which could very probably be missing from the Unity’s default font. That would also explain the question mark symbol on a Mac.