upon using a textbox to enter my name, my game camera was not following the player in the final build…i take out the textbox script and it works…what is the problem…Or how can I save the string from the textbox, then destroy the script?
It depends on what you wrote in your script
You can save string in this way:
string text = ""
void OnGUI()
{
text = GUI.TextField(newc Rect(10,10, 100, 30), text);
}
and destroy script with Destroy method:
Destroy(this);
the input script is simple
using UnityEngine;
using System.Collections;
public class NameInput : MonoBehaviour {
public static string HighScoreName ="";
public GUIText ShowName;
void Start () {
}
void OnGUI () {
HighScoreName = GUI.TextField(new Rect(10,10,200,20),HighScoreName,25);
if(Input.GetKeyDown(KeyCode.Return))
{
ShowName.text = "Your Name is " + HighScoreName;
}
}
}
sorry must have wrote the above while you were