- Home /
I am having a bunch of "invalid token" errors that I don't understand. Help plz
This is what my code looks like (don't judge, I am a total noob and am trying to follow a tutorial)
using UnityEngine; using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
void OnTriggerEnter2D (Collider2D other);
(
if(other.tag == "Player")
{
Debug.Break ();
}
if(other.gameObject.transform.parent)
{
Destroy (other.gameObject.transform.parent.gameObject);
}
)
};
Comment
Best Answer
Answer by Mexallon · Dec 14, 2014 at 07:59 PM
The Problem are the parenthesis (curly brackets instead) and the semicolon
Try this one
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other) {
if(other.tag == "Player") {
Debug.Break();
}
if(other.gameObject.transform.parent) {
Destroy(other.gameObject.transform.parent.gameObject);
}
}
}
Your answer
Follow this Question
Related Questions
Expecting eof found } 1 Answer
Invalid IL Code Error 0 Answers
Unexpected token: if 1 Answer
Facebook cannot find my Unity data file. 1 Answer
Custom Lobby - Ready to begin message for each player 0 Answers