All I want to do is get the variable newtext back to just below main section so that I can continue to use it, but whatever I try I can't. I'm very new to c# and unity, I'm trying to do a old school adventure like the ones in the 80's I've written a script under this to break the input newtext into verb and noun (which works), just can't get the string newtext back to allow me to do this, any help with this would be greatly appreciated.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Textinput : MonoBehaviour {
// declare variables below
InputField input;
InputField.SubmitEvent se;
public Text output;
// declare variables above
void Start () {
input = gameObject.GetComponent<InputField>();
se = new InputField.SubmitEvent();
se .AddListener(SubmitInput);
input.onEndEdit = se;
//want varable script to come back here to use ie "newtext" to use after this point
// **split word script here **
}
// my voids below
private void SubmitInput(string arg0)
{
string currentText = output.text;
string newText = arg0;
output.text = newText;
input.text = "";
input.ActivateInputField();
}
}