- Home /
Question by
Quantization · Jun 25, 2014 at 02:28 PM ·
gameobjectobjectdeleteunexpectedsymbol
Unexpected symbol, "Projectile" while attempting to delete gameObject.Projectile
I am really new to scripting.
Here's what I've got so far:
void OnCollisionEnter(Collision Dest) {
if(Dest.gameObject.name == "Projectile")
{
Destroy(Object.Projectile);
}
void Update() { OnCollisionEnter(); }
Can't get the method to do anything, I've attached it to the projectile gameobject and everything.
Comment
Answer by Xtro · Jun 25, 2014 at 04:07 PM
1) in OnCollisionEnter method, you should do this...
if(Dest.gameObject.name == "Projectile")
{
Destroy(Dest.gameObject);
}
2) You shouldn't call OnCollisionEnter() in the update event. It's supposed to be called by the unity itself.
Your answer
Follow this Question
Related Questions
What do I get this error message for?Unexpected symbol gameObject 1 Answer
Destroy the current GameObject? 7 Answers
Cannot convert object to gameObject 3 Answers
unexpected symbol 'private' 0 Answers
How to instantiate within GameObject 1 Answer