I’ve created this script to open a GUI Texfield. But there is an error in my script…
error: “Assets/Scripts/TypeName.js(2,16): BCE0018: The name ‘TextField’ does not denote a valid type (‘not found’)”
Here is the script:
var stringToEdit : String = "Type in your NAME";
var TextArea : TextField;
function OnGUI () {
stringToEdit = TextArea.text;
}
hmmm TextField is not a class to so that you can declare a object for it, it is just a function in unity. you can call a function but not declare it as a type for a variable. From the method what i understand you are trying to do something like this…
var stringToEdit : String = "Hello World";
var viewportArea : Rect;
function OnGUI () {
// Make a text field that modifies stringToEdit.
stringToEdit = GUI.TextField (viewportArea, stringToEdit, 25);
}