Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Writing / in a string?

Discussion in 'Scripting' started by RoryScanlan, Aug 28, 2014.

  1. RoryScanlan

    RoryScanlan

    Joined:
    Jan 25, 2014
    Posts:
    139
    So this is pretty dumb but i want to write a fraction in a string.. but it seems to be ignoring the / even when its braced in "" .

    Here is the line of code
    Code (CSharp):
    1. GUI.Label(new Rect(Screen.width / 100, Screen.height / 15, Screen.width / 15, Screen.height / 15), "Lap Number :" + checkpointCount.Lapcount +" / " +lapcounter.MaximumLaps, guiSkin2); // lap Number
    It just simple ignores the " / " and does not show it :(
     
  2. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    I think it's to do with your GUISkin, Just tested in my unity without the skin and it works perfectly
     
  3. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    the font in your skin might not have the '/' key, or the data from your font is missing or something
     
    RoryScanlan likes this.
  4. RoryScanlan

    RoryScanlan

    Joined:
    Jan 25, 2014
    Posts:
    139
    Yep it was my font thanks dude another great tip :)
     
  5. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    It's all good :)