Trying to figure this out with no luck. When my “Shredder” destroys the gameObject (coll.gameObject) - which should be the single instance- I get that error and my cactus and gnome stop shooting.
I attached my scripts. The compiler says the error is under Shooter on line 12 that says
12 {"GameObject newProjectile = Instantiate (projectile); }
Thanks for any help.
Shooter:
void Fire()
{
GameObject newProjectile = Instantiate (projectile) as GameObject;
newProjectile.transform.parent = projectileParent.transform;
newProjectile.transform.position = transform.Find ("Gun").position;
}
}
Shredder :
void OnTriggerEnter2D(Collider2D coll)
{
DestroyObject (coll.gameObject);
}