hey all, I get this parse error and some other errors when I want to implement the code for using the zxing barcode scanner.
this is the code I use:
`using UnityEngine; using System.Collections;
public class Scanner : MonoBehaviour {
// Use this for initialization
void Start () {
gameObject.Find("ScanBtn").setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}
});
}
// Update is called once per frame
void Update () {
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
gameObject.Find("ScanBtn").Destroy();
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
}
}`
the errors that I get are these:
Assets/Scanner.cs(10,22): error CS1526: A new expression requires () or [] after type
Assets/Scanner.cs(10,42): error CS1525: Unexpected symbol `v'
Assets/Scanner.cs(15,18): error CS8025: Parsing error
any help would be greatly appreciated :)