The question is answered, right answer was accepted
[Solved] Saving data from Input Field
Hi, I have this code to an input field so the user can enter a name and email before playing the game, so I can have a list of every person that plays the game. Is there any way to save this data in a text file in a way that updates every time someone enters a name and email? This is the code I have:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
public class NewBehaviourScript : MonoBehaviour {
public Button myButton;
public Text buttonText;
public InputField name, email;
string Name;
string Email;
void Start () {
myButton = GetComponent<Button> ();
buttonText = GetComponentInChildren<Text> ();
myButton.onClick.AddListener (ProcessText);
}
void ProcessText() {
Debug.Log ("Button was Clicked!");
myButton.enabled = false;
Name = name.text;
Email = email.text;
Debug.Log("O nome é: " + Name);
Debug.Log ("O email é: " + Email);
}
}
Answer by hexagonius · Mar 21, 2017 at 05:09 PM
this is probably what you need:
TextAsset asset = Resources.Load("test") as TextAsset;
this is right! https://docs.unity3d.com/ru/530/$$anonymous$$anual/class-TextAsset.html
Follow this Question
Related Questions
Input Field Problem 0 Answers
How can I reset the placeholder of an input field back to the default readout? 2 Answers
How do I let users change the background color of a selected word in an input field? 0 Answers
how to use scientific values in inputfield unit or restrict only some letters 0 Answers
InputField not able to hold long text 2 Answers