Question by
Doug24 · Jan 02, 2016 at 11:07 AM ·
unity 5error messageunity 4.6errormessage
public UnityEngine.UI.Text fixing errors.
For the closing } in the debugger I get the error Invalid token '}' indexer class, struct, or interface member declaration
using UnityEngine;
using System.Collections;
public class click : MonoBehaviour
{
public UnityEngine.UI.Text
}
If i put public UnityEngine.UI.Text out of the {} brackets it shows UnityEngine as an error if I add ; it shows up as the first error I'm using unity 5.3.1 and the tutorial I was following was in unity 4.6.1 I'm guessing it's something to do with the different versions but I don't know what or how to do it for unity 5.3.1 ?
Comment
Answer by OncaLupe · Jan 03, 2016 at 10:31 AM
You have two problems. First, you're not providing a variable name to be created. Second, you're missing the line ending semicolon.
using UnityEngine;
using System.Collections;
public class click : MonoBehaviour
{
public UnityEngine.UI.Text varName;
}
You might want to watch Unity's scripting tutorials, or look up some ones on YouTube about C#/Unity scripting basics.