Non-breaking space in Unity3D/NGUI

I was messing with some text line wrapping an an app today, and needed to stop NGUI inserting a line break between a number and a label in a long string.  Using the escape sequence ‘\u00A0’ did the trick.

return category + "\u00A0#" + indexInCategory;

Now the last word in the string category and the number preceded with a # stay on the same line!

Note: I read that pressing ALT-Space on the Mac will insert this character.  It may do that, but MonoDevelop/NGUI don’t seem to care.  The escape literal worked, the ALT-Space just acted like a regular space.

Note: To insert a non-breaking space in a XML document without using Document Entities, use the following:  

Leave a Reply