Мои Уведомления
Привет, !
Мой Аккаунт Мои Финансы Мои Подписки Мои Настройки Выход
Руководство API скрипты

PlayerPrefs.GetString

Объявление

public static string GetString(string key);

public static string GetString(string key, string defaultValue);

Описание

Возвращает значение, соответствующее key в файле настроек, если он существует.

Если он не существует, он вернет defaultValue.

// Используйте этот скрипт, чтобы получить настройки и отобразить их в виде текста на экране. using UnityEngine; using UnityEngine.UI; public class PlayerPrefsDeleteAllExample : MonoBehaviour { string m_PlayerName; void Start() { // Получаем настройки PlayerPref SetText(); } void SetText() { //Fetch name (string) from the PlayerPrefs (set these Playerprefs in another script). If no string exists, the default is "No Name" m_PlayerName = PlayerPrefs.GetString("Name", "No Name"); } void OnGUI() { //Fetch the PlayerPrefs settings and output them to the screen using Labels GUI.Label(new Rect(50, 50, 200, 30), "Name : " + m_PlayerName); } }
Вы можете отблагодарить автора, за перевод документации на русский язык. ₽ Спасибо
API скрипты 2021.3