Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using System.Xml;
- using System.IO;
- public class LOGINTESTSCRIPT : MonoBehaviour
- {
- private string currentUsername;
- private string currentPassword;
- public InputField mainInputField;
- void Update()
- {
- if(GetKeyDown)
- }
- public void CreateLogin()
- {
- currentUsername = transform.parent.GetChild(0).GetComponent<UsernameScript>().InputUsername();
- currentPassword = transform.parent.GetChild(1).GetComponent<PasswordScript>().InputPassword();
- string filePath = Application.dataPath + "User1.xml";
- if (File.Exists(filePath))
- File.Delete(filePath);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml("<User ></User>");
- XmlElement root = xmlDoc.DocumentElement;
- root.SetAttribute("name", currentUsername);
- XmlElement node = xmlDoc.CreateElement("Password");
- node.SetAttribute("pass",currentPassword);
- root.AppendChild(node);
- xmlDoc.Save("User1.xml");
- }
Add Comment
Please, Sign In to add comment