Search Unity

Convert PlayerPrefs Int for GUI.Label

Discussion in 'Scripting' started by skullred, Dec 19, 2014.

  1. skullred

    skullred

    Joined:
    Dec 24, 2012
    Posts:
    49
    hi, I would like it to be printed in GUI.Label the value that is inside of a PlayerPrefs:

    Code (CSharp):
    1. GUI.Label(new Rect(850, 400,30 , 20), PlayerPrefs.GetInt("Potion"));
    The problem is that the GUI.Label only accepts values in "string". How would I go to print the value equally?
     
  2. skullred

    skullred

    Joined:
    Dec 24, 2012
    Posts:
    49
    I solved with .ToString();

    Code (CSharp):
    1. GUI.Label(new Rect(*RECT*), PlayerPrefs.GetInt("Potion").ToString());