using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MySettings : MonoBehaviour
{
public string playernamestr;
public Text playername;
void Start()
{
playernamestr = playername.text;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Names : MonoBehaviour
{
public string theName;
public GameObject inputField;
public GameObject textDisplay;
public InputField playername;
private string names;
private int index = 0;
public void StoreName()
{
Debug.Log("Player Name is:" + playername.text);
MySettings.palyernamestr = playername.text;
theName = inputField.GetComponent<Text>().text;
if (index > 0)
{
names = names + ", " + theName;
}
else
{
names = names + theName;
}
index += 1;
textDisplay.GetComponent<Text>().text = names;
}
}