Menu Close

Input Field In Unity | Save/Store Input Field Data | Unity Tutorial 17

0 0
Read Time:22 Second

👉Description:

You’ll Learn About the Input Field in Unity. Input Field All Properties And Components Are Explained Here.

C# Script For Save and Get Data:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SaveAndGetData : MonoBehaviour
{
    [SerializeField] InputField input;
    [SerializeField] Text textview;
   
    public void SaveData()
    {
        string data = input.text;
        PlayerPrefs.SetString("InputData", data);
    }
    public void ShowData()
    {
        textview.text = PlayerPrefs.GetString("InputData");
    }
}
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published.

%d bloggers like this: