Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

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

PlayerPrefs.SetFloat

public static void SetFloat(string key, float value);

Description

Sets the value of the preference identified by key.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { PlayerPrefs.SetFloat("Player Score", 10.0F); } }