Script language:

  • JS
  • C#
  • Boo
Script language

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

Suggest a change

PlayerPrefs.SetString

static function SetString(key: string, value: string): void;
static void SetString(string key, string value);
static def SetString(key as string, value as string) as void

Description

Sets the value of the preference identified by key.

	PlayerPrefs.SetString("Player Name", "Foobar");
using UnityEngine;
using System.Collections;

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

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		PlayerPrefs.SetString('Player Name', 'Foobar')

Your name (optional):
Your email (optional):
Please write your suggestion here: