Legacy Documentation: Version 5.3
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

PlayerPrefs.SetInt

public static void SetInt(string key, int value);

Parameters

Description

Sets the value of the preference identified by key.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { PlayerPrefs.SetInt("Player Score", 10); } }