Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

error CS1061 and error CS0117 scripting InputField

$
0
0
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.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>