Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Why? I would really appreciate your help.

Discussion in 'Documentation' started by thanhdanh047, Jul 7, 2018.

  1. thanhdanh047


    Jul 7, 2018
    I am working on a project where I want to make a Scoreboard scene but before I started, I wanted to know and understand what PlayerPrefs.GetInt() was. After reading the api, I did a test to see if it works. I went to the registry editor on windows, went to my project and added a new string value called Player Name, and I attached an int value of 20, just for the test. I created an int variable called number and I made it public so I can see what value is attached to it when I ran unity. Here is my script:
    Code (CSharp):
    1. public int number;

    2. void Start() {
    3. number = PlayerPrefs.GetInt ("Player Name", 10);
    4. }
    And for some kind of reason, the only number attached to 'number' is 10. Why? I would really appreciate your help. If you have any questions, you can simply ask.