I'm trying to create an Input Field to send commands to a simple AI.
I'm getting this error:
***Assets/Scripts/InputController.cs(15,23): error CS1061: Type 'string' does not contain a definition for 'text' and no extension method 'text' of type 'string' could be found (are you missing a using directive or an assembly reference?)
***
From this following script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class InputController : MonoBehaviour {
private InputField input;
void Awake(){
input = GameObject.Find ("InputField").GetComponent();
}
public void GetInput(string input){
Debug.Log (input);
input.text = "";
}
}
FYI: The 'text' parameter in the input component is highlighted in red in the MonoDevelop:
public void GetInput(string input){
Debug.Log (input);
input.text = "";
}
When I hover over it in the MonoDevelop I get the following error in a balloon message:
***Error CS0117: 'System.String' does not contain a definition for 'text'***
* I test this in a plain new project and scene and it works.
↧