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.SetString

public static void SetString(string key, string value);

Parameters

Description

Sets the value of the preference identified by key.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { PlayerPrefs.SetString("Player Name", "Foobar"); } }